P is a positive decimal (base 10) integer consisting entirely of the digit 3, and Q is a positive decimal integer consisting entirely of the digit 7. In the base10 expansion of P*Q, the digit 3 is repeated precisely three times and the digit 7 is repeated precisely seven times. The product P*Q may consist of other digits besides 3 and 7.
Given that N is the minimum value of P*Q, determine the remainder when N is divided by 37.
Note: Try to derive a non computer assisted method, although computer programs/spreadsheet solutions are welcome.
N will be the product of 3*7 times two repunit integers (integers consisting of repeated 1's in decimal notation). In general, the size of the number N will increase as the total of 1's in the two repunits' representations.
The following UBASIC program goes through increasing total number of 1's in the repunits:
10 for T=2 to 1000
20 for A=1 to int(T/2)
30 B=TA
40 R1=int((10^A1)/9)
50 R2=int((10^B1)/9)
60 Prod=21*R1*R2
70 S=cutspc(str(Prod))
80 Ct3=0:Ct7=0
90 for I=1 to len(S)
100 if mid(S,I,1)="3" then inc Ct3
110 if mid(S,I,1)="7" then inc Ct7
120 next
130 if Ct3=3 and Ct7=7 then
131 :print A,R1:print B,R2
132 :print Prod:print Prod@37:print T:print log(Prod)/log(10)
140 next
150 next
It finds only
22 1111111111111111111111
25 1111111111111111111111111
25925925925925925925923330740740740740740740741
meaning that the smaller repunit has 22 1's and the larger has 25, so P and Q can consist of 22 3's and 25 7's, respectively or 25 3's and 22 7's.
The resulting N is 25925925925925925925923330740740740740740740741.

Posted by Charlie
on 20081102 23:43:33 