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

Home > Numbers
Prime square with distinct digits (Posted on 2009-05-30) Difficulty: 2 of 5
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.)
Solution 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   endloop
100   print Ct
produces
2 4
3 9
5 25
7 49
13 169
17 289
19 361
23 529
29 841
31 961
37 1369
43 1849
53 2809
59 3481
61 3721
71 5041
73 5329
79 6241
89 7921
113 12769
137 18769
179 32041
181 32761
191 36481
193 37249
199 39601
233 54289
269 72361
281 78961
311 96721
353 124609
367 134689
397 157609
463 214369
487 237169
509 259081
557 310249
571 326041
593 351649
647 418609
661 436921
677 458329
709 502681
733 537289
757 573049
797 635209
829 687241
839 703921
929 863041
1117 1247689
1277 1630729
1307 1708249
1433 2053489
1873 3508129
1949 3798601
2027 4108729
2069 4280761
2203 4853209
2311 5340721
2339 5470921
2557 6538249
2699 7284601
2711 7349521
2731 7458361
2801 7845601
2927 8567329
3041 9247681
4157 17280649
4663 21743569
4967 24671089
4987 24870169
6043 36517849
6199 38427601
6737 45387169
6763 45738169
6899 47596201
7237 52374169
7549 56987401
7621 58079641
7699 59274601
8191 67092481
8599 73942801
8623 74356129
9181 84290761
13147 172843609
20089 403567921
21397 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
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (9)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information