A = 1 + 6 + 62 + ... + 632
= 1 + (6 + 62 + 63 + 64) + (65 + 66 + 67 + 68) + ... + (629 + 630 + 631 + 632)
= 1 + (62 + 1).(62 + 6) + 64(62 + 1)(62 + 6) + .... + 628(62 + 1)(62 + 6)
= 1 + (62 + 1).(62 + 6).(1 + 64 + ... + 628)
= 1 + 37. (62 + 6).(1 + 64 + ... + 628)
=> A : 37 dư 1
Khi đó 2A + 3 = 2.[1 + 37. (62 + 6).(1 + 64 + ... + 628)] + 3
= 2 + 2.37. (62 + 6).(1 + 64 + ... + 628) + 3
= 5 + 2.37. (62 + 6).(1 + 64 + ... + 628)
=> P = 2A + 3 : 37 dư 5