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

Home > Numbers
Prime squares with distinct digits 2 (Posted on 2023-05-02) Difficulty: 3 of 5
Determine the maximum value of a duodecimal (base 12) prime number N, such that none of the digits in the base 12 representation of N2 occur more than once.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Computer solution | Comment 1 of 2
The largest possible duodecimal pandigital is BA9876543210, which is 8842413667692 in decimal.
It's square root is 2973619.623
So, an upper limit for N is 2973619.

Algorithm:  Loop from the upper limit down discarding non-primes.  Convert the square of each prime to duodecimal and check for absence of repeat digits.

N = 846977 
N^2 = 717370038529 
N^2 (base 12) = B7045936281
----------------
def dec2base(i,base):
    """ INPUT integer in base 10, return string 
    of Base base equivalent. """
    convertString = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    if i < base:
        return convertString[i]
    else:
        return dec2base(i//base,base) + convertString[i%base]

def isprime(n):
    '''check if integer n is a prime'''
    n = abs(int(n))
    if n < 2:
        return False
    if n == 2: 
        return True    
    if not n & 1: 
        return False
    for x in range(3, int(n**0.5)+1, 2):
        if n % x == 0:
            return False
    return True

for n in range(2973620, 0, -1):
    if not isprime(n):
        continue
    x = dec2base(n**2, 12)
    if len(x) == len(set(x)):
        print(n, n**2, x)
----------------

846977 717370038529 B7045936281
843473 711446701729 B5A72089341
833977 695517636529 B2967548301
833009 693903994081 B2597063481
775091 600766058281 98523406BA1
728209 530288347681 869345B2A01
705769 498109881361 80653BA9241
705521 497759881441 8057693AB41
693661 481165582921 79305468B21
682819 466241786761 7643B5209A1
673193 453188815249 739B8025A41
652369 425585312161 6A5937B0481
587897 345622882609 56B984A2301
577547 333560537209 547908BA361
572791 328089529681 53704629B81
560617 314291420689 50AB3689241
550279 302806977841 4A82953B701
513311 263488182721 430957AB281
496187 246201538969 3B870492561
496163 246177722569 3B8645079A1
488473 238605871729 3A2B0759841
484123 234375079129 3950B8A6421
481667 232003098889 38B69450721
471389 222207589321 37094A56B21
467479 218536615441 3642B578901
465631 216812228161 36029B87541
447991 200695936081 32A907B5641
415213 172401835369 294B50387A1
247799 61404344401 BA98235641
246773 60896913529 B9763054A1
244303 59683955809 B698052341
242971 59034906841 B5368072A1
241453 58299551209 B37049A261
238723 56988670729 B0654829A1
235309 55370325481 A8934B0521
233489 54517113121 A695807341
233221 54392034841 A65B948021
232129 53883872641 A539724801
227561 51784008721 A052439781
226487 51296361169 9B3706A241
219361 48119248321 93AB057281
218843 47892258649 934702B561
213329 45509262241 89A0B62741
208729 43567795441 853A924701
206993 42846102049 83790A5B41
200437 40174990969 79526340A1
197063 38833825969 7639452B01
193951 37616990401 7359A2B801
179321 32156021041 6294BA0581
177091 31361222281 60B29875A1
174481 30443619361 5A9760B341
172619 29797319161 593708AB61
172093 29616000649 58A6409321
171713 29485354369 586A703941
168761 28480275121 5629BA0841
166841 27835919281 548A239701
165313 27328387969 536827B401
164023 26903544529 5269B38A41
161753 26164033009 50A2346981
160997 25920034009 5034697821
160141 25645139881 4B78609521
156901 24617923801 49305AB821
148927 22179251329 436B952A81
142757 20379561049 3B490A7561
142123 20198947129 3AB8705621
140197 19655198809 39865A0421
140171 19647909241 3984065A21
139861 19561099321 395AB80761
137143 18808202449 378A9B4501
134333 18045354889 35B7429861
133709 17878096681 356B408921
133169 17733982561 352B0A9481
132437 17539558969 3495B678A1
128873 16608250129 327609BA41
126023 15881796529 30B2946581
125963 15866677369 30A9874B61
125053 15638252809 30452769A1
121007 14642694049 2A07985341
117389 13780177321 2806B537A1
117071 13705619041 27A5B98601
113161 12805411921 259460B381
111791 12497227681 2509367B41
111263 12379455169 2495A30681
109199 11924421601 238956AB41
108503 11772901009 2346879501
102953 10599320209 2079835A41
71161 5063887921 B93A76841
71147 5061895609 B932758A1
70793 5011648849 B7A483901
69827 4875809929 B40A95321
69389 4814833321 B24589A61
69371 4812335641 B23784561
68633 4710488689 AB5649301
68099 4637473801 A950B7321
67103 4502812609 A57B96401
65761 4324509121 A08329541
65287 4262392369 9AB572301
63691 4056543481 9526408A1
62983 3966858289 9285AB701
62303 3881663809 903B65281
62143 3861752449 8B9362541
62011 3845364121 8B397A561
60757 3691413049 8702B64A1
60703 3684854209 86A072941
60637 3676845769 867450321
60353 3642484609 857A3B401
60337 3640553569 857269A01
59747 3569704009 8375A0B21
59417 3530379889 826397B01
58601 3434077201 7BA095241
58481 3420027361 7B543A601
58057 3370615249 7A098B641
57427 3297860329 780543BA1
56711 3216137521 7590B2841
56597 3203220409 754903621
56479 3189877441 750349A81
55681 3100373761 726385941
55051 3030612601 706B428A1
54013 2917404169 695048721
53939 2909415721 6924357A1
53323 2843342329 6742908A1
52817 2789635489 65A2B0481
52747 2782246009 6579280A1
50549 2555201401 5B3894621
50539 2554190521 5B3487621
50377 2537842129 5A9B02781
50069 2506904761 59B6830A1
49253 2425858009 5784B9021
49207 2421328849 576A93B81
49019 2402862361 570869421
47791 2283979681 538A97601
45553 2075075809 49AB32081
45053 2029772809 487925061
44987 2023830169 48593A021
44279 1960629841 46873B901
43669 1906981561 452789361
42773 1829529529 430857621
42359 1794284881 420A9B381
41603 1730809609 403789B21
41243 1700985049 3B57A6421
41233 1700160289 3B5469081
40577 1646492929 39B4A7681
40559 1645032481 39AB02481
40189 1615155721 390AB4721
39799 1583960401 38256B901
39103 1529044609 3680A7941
39023 1522794529 365B92A01
38603 1490191609 35708B4A1
38351 1470799201 350698B41
38197 1459010809 348752B61
36353 1321540609 30A6B8541
36191 1309788481 30678B541
35447 1256489809 2B0967381
35201 1239110401 2A6B85941
34729 1206103441 297B08641
34673 1202216929 296753481
34631 1199306161 29578AB01
34549 1193633401 2938B40A1
34519 1191561361 293074B81
33311 1109622721 26B73A941
32779 1074462841 25BA03761
32573 1061000329 2573B09A1
32411 1050472921 2539746A1
31859 1014995881 243B05A61
29761 885717121 20875B941
29717 883100089 2078B9361
20611 424813321 BA329061
20507 420537049 B8A06421
20431 417425761 B7965A01
20359 414488881 B698A301
20117 404693689 B36458A1
19919 396766561 B0A62341
19597 384042409 A8746921
19471 379119841 A6B72081
19219 369369961 A384B921
19121 365612641 A2539481
18919 357928561 9BA52701
18899 357172201 9B748A61
17449 304467601 85B70641
17351 301057201 849A6B01
17183 295255489 82A69541
16903 285711409 7B826301
16871 284630641 7B3A4981
16703 278990209 79524801
16649 277189201 789B6501
16619 276191161 785B4A21
16273 264810529 74826A01
15907 253032649 708A6B21
15887 252396769 7063AB41
15817 250177489 6B94A781
15683 245956489 6A453B21
15091 227738281 64328BA1
14969 224070961 6305A841
14951 223532401 62A3B041
14753 217651009 60A83541
14633 214124689 5B862901
14593 212955649 5B39A281
14543 211498849 5A9B7201
14479 209641441 5A260341
14411 207676921 596734A1
14081 198274561 5649A281
13781 189915961 537290A1
13757 189255049 5346A721
13217 174689089 4A605281
13109 171845881 49673A21
13103 171688609 495B8A01
13037 169963369 48B06521
12703 161366209 4605B281
12347 152448409 4307A561
11927 142253329 3B782641
11903 141681409 3B547681
11783 138839089 3A5B6841
11699 136866601 39A05261
11467 131492089 38052B61
11287 127396369 367B8901
11149 124300201 35764BA1
11117 123587689 354807A1
11047 122036209 34A52981
10993 120846049 3457A081
10487 109977169 309B8241
10463 109474369 307B5281
10337 106853569 2B950681
10069 101384761 29B538A1
9871 97436641 2876AB41
9781 95667961 280574A1
9749 95043001 279B58A1
9743 94926049 2795A081
9413 88604569 2580B961
9311 86694721 2504A681
9049 81884401 2350A981
9041 81739681 2345B081
5953 35438209 BA50281
5897 34774609 B790241
5861 34351321 B6072A1
5839 34093921 B502341
5821 33884041 B4209A1
5807 33721249 B362741
5783 33443089 B249781
5651 31933801 A840261
5623 31618129 A709641
5477 29997529 A067821
5449 29691601 9B3A781
5431 29495761 9A65381
5393 29084449 98A7341
5387 29019769 9875A21
5273 27804529 938A701
5233 27384289 9207481
5179 26822041 8B96021
5167 26697889 8B36201
5021 25210441 8539461
5003 25030009 8470B61
4987 24870169 83B4561
4973 24730729 8347921
4789 22934521 7820361
4721 22287841 756A081
4639 21520321 7259A81
4567 20857489 6B9A381
4457 19864849 679BA41
4447 19775809 6758401
4327 18722929 632B041
4253 18088009 6083721
4133 17081689 58792A1
4111 16900321 57B0341
4001 16008001 543BA81
3851 14830201 4B72361
3767 14190289 4903B81
3727 13890529 479A601
3709 13756681 4735061
3701 13697401 47068A1
3673 13490929 4627301
3659 13388281 4597A21
3571 12752041 432B7A1
3449 11895601 3B98041
3407 11607649 3A79481
3391 11498881 3A26541
3373 11377129 3987BA1
3347 11202409 3902A61
3329 11082241 3865401
3323 11042329 38462A1
3307 10936249 37B4A21
3203 10259209 3529061
3191 10182481 34B0781
3181 10118761 347B921
2963 8779369 2B347A1
2903 8427409 29A4B81
2851 8128201 287B9A1
2833 8025889 2830741
2777 7711729 26BA981
2719 7392961 2586401
1709 2920681 B8A261
1699 2886601 B725A1
1607 2582449 A46581
1601 2563201 A37401
1571 2468041 9B0321
1451 2105401 8564A1
1439 2070721 83A401
1373 1885129 76AB21
1361 1852321 753B41
1319 1739761 6BA981
1249 1560001 632941
1187 1408969 57B461
1151 1324801 53A801
1109 1229881 4B38A1
1063 1129969 465B01
1051 1104601 4532A1
1049 1100401 450981
983 966289 3A7241
977 954529 3A0481
971 942841 395761
947 896809 372BA1
941 885481 368521
919 844561 348901
857 734449 2B5041
827 683929 28B961
821 674041 2860A1
809 654481 276901
491 241081 B7621
487 237169 B5301
479 229441 B0941
463 214369 A4081
443 196249 956A1
439 192721 93641
431 185761 8B601
419 175561 85721
401 160801 79081
389 151321 736A1
383 146689 70A81
367 134689 65B41
359 128881 62701
347 120409 59821
331 109561 534A1
311 96721 47B81
283 80089 3A421
281 78961 39841
277 76729 384A1
269 72361 35A61
251 63001 30561
241 58081 29741
239 57121 29081
233 54289 27501
227 51529 259A1
131 17161 9B21
127 16129 9401
113 12769 7481
89 7921 4701
83 6889 3BA1
79 6241 3741
71 5041 2B01
41 1681 B81
37 1369 961
31 961 681
29 841 5A1
23 529 381
19 361 261
17 289 201
11 121 A1
7 49 41
5 25 21
3 9 9
2 4 4

  Posted by Larry on 2023-05-02 09:06:37
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


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

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