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

Home > Numbers
Pandigital and Pretty Powerful VI (Posted on 2023-11-13) Difficulty: 3 of 5
Determine all possible triplet(s) (P, Q, N) of duodecimal positive integers, with P<Q and N≥3, such that the base 12 representations of PN and QN will together contain each of the digits 0 to B exactly once. Neither PN nor QN can contain any leading zero.

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 Solution Comment 3 of 3 |
The smallest P can be is 1
If N is 3, the largest Q^N can be is BA987654320 ^ (1/3) which is (decimal) 9032.262
My algorithm is to make a list of all cubes (or whatever power) from decimal 1^3 to 9032^3 converted to base 12 (or whatever the largest Q can be raised to whatever power), then separate that into a dictionary by the length of the base 12 representation.  Then I only need to test cubes of length 2 against cubes of length 10; length 3 vs length 9, etc.

The dictionary is reconstructed for each power.
I tested powers from 2 to 21.  At power 22, 2^22 is already 7 digits in base 12.

I only found solutions in powers 2 (12 solutions) and 3 (3 solutions).  

P Q N base 10
P Q N base 12
P^N Q^N
-------  Base 2 ----------
11 109065 2
B 53149 2
A1 237B805469 

11 159918 2
B 78666 2
A1 4B58729630 

33 42955 2
29 20A37 2
769 435B208A1 

33 66319 2
29 32467 2
769 A28B50341 

66 13343 2
56 787B 2
2630 4B759A81 

99 10120 2
83 5A34 2
5809 2A36B714 

99 15059 2
83 886B 2
5809 63B427A1 

198 5852 2
146 3478 2
1A830 B576294 

242 5797 2
182 3431 2
29A84 B307561 

275 4202 2
1AB 2522 2
37921 5AB6084 

473 4686 2
335 2866 2
A9581 742B630 

484 3949 2
344 2351 2
B3694 52807A1 

-------  Base 3 ----------
6 1083 3
6 763 3
160 2B5497A83 

14 437 3
12 305 3
1708 23B469A5 

18 587 3
16 40B 3
3460 578A192B

--------------------
def b12(n):
    return base2base(n,10,12)
def b10(n):
    return base2base(n,12,10)

for power in range(2,22):
    maxQ = int(b10('BA987654320') ** (1/power))
    pqPowers = [b12(i**power) for i in range(1,maxQ + 1)]
    pqLengthDict = {}
    keys = pqLengthDict.keys()
    for p in pqPowers:
        length = len(p)
        if length not in pqLengthDict:
            pqLengthDict[length] = [p]
        else:
            pqLengthDict[length].append(p)
    
    for pLength in range(1,7):
        qLength = 12 - pLength
        if pLength in keys and qLength in keys:
            for pPow in pqLengthDict[pLength]:
                for qPow in pqLengthDict[qLength]:
                    pqConcat = pPow + qPow
                    if len(pqConcat) == 12 and len(set(pqConcat)) == 12 :
                        power10P = round(b10(pPow)**(1/power))
                        power10Q = round(b10(qPow)**(1/power))
                        print (power10P, power10Q, power )
                        print (b12(power10P), b12(power10Q), power )
                        print(pPow,qPow, ' ')
                    

Edited on November 13, 2023, 11:41 am
  Posted by Larry on 2023-11-13 11:39:35

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 (13)
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