All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Prime square with distinct digits (Posted on 2009-05-30)
Determine the maximum value of a positive prime N, such that none of the digits in the base ten representation of N2 occur more than once.

 See The Solution Submitted by K Sengupta No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 UBASIC solution Comment 2 of 2 |
` 10   loop 20    N=nxtprm(N) 30    N2=cutspc(str(N*N)) 35    Good=1 40    for I=1 to len(N2)-2 50       if instr(I+1,N2,mid(N2,I,1))>0 then Good=0 60    next 70    if Good then print N;N2:Ct=Ct+1 75    if len(N2)>10 then goto 100 80   endloop100   print Ct`
`produces`
`2 43 95 257 4913 16917 28919 36123 52929 84131 96137 136943 184953 280959 348161 372171 504173 532979 624189 7921113 12769137 18769179 32041181 32761191 36481193 37249199 39601233 54289269 72361281 78961311 96721353 124609367 134689397 157609463 214369487 237169509 259081557 310249571 326041593 351649647 418609661 436921677 458329709 502681733 537289757 573049797 635209829 687241839 703921929 8630411117 12476891277 16307291307 17082491433 20534891873 35081291949 37986012027 41087292069 42807612203 48532092311 53407212339 54709212557 65382492699 72846012711 73495212731 74583612801 78456012927 85673293041 92476814157 172806494663 217435694967 246710894987 248701696043 365178496199 384276016737 453871696763 457381696899 475962017237 523741697549 569874017621 580796417699 592746018191 670924818599 739428018623 743561299181 8429076113147 17284360920089 40356792121397 457831609`

87

showing 87 primes meet the criterion and the highest is 21397 whose square is 457831609.

 Posted by Charlie on 2009-05-30 16:02:26

 Search: Search body:
Forums (0)