Let N and P be positive integers, with 1<P≤50, such that N
P contains N.
Find one example where N is a 9-digit pandigital number, and three examples where N is a 10-digit pandigital number.
I assumed the 9-digit pandigital was zeroless.
826315794 ^ 23 =
124267979816871399763181948338009657601789410089256519672845
915358846391681276904814428903919561965122253432263631492086
422569882493648014426448439252465286351884136799035826315794
60068981211460106226499584
3416295807 ^ 41 = 751232183030370314341835310267085219164792715173845645163340
173584365289044336837217382138511978934244391906738328884973
344120019390377538203623514712521895079843624682239238614037
530392004359811356469822606518562344516012802556858769581014
122277912319190204735974969555384857816450389523368571295434
453326309176244125721510264130056042177560818210016040917588
3159019810334869856873416295807
6359807241 ^ 47 = 577917417565347227270043929065293990793598070655767840333548
981084797828875445798070876638716890325453574266710757866310
704034419029906568801916363073072965232756049512984865466510
764939095635980724123613472190223429748689384471035788150094
393391805976217006636752689125719934569888841840918071340532
215840012913057305778411390486824689838562678259597307391610
075525545008611454626767445385803598657936642949206005463821
34145582561814542777036868228938362525881
8509342671 ^ 40 = 156978625263507271259345484965019976956280598477562879962029
350656430140390843084754110376099385870858937181061130615630
022031963530328783826575314020146515870914690119122389819545
902969541487271685655793973736526019623683175816207525158850
934267199140446902420244766043645443146461504748515085888712
411065192258881560945393952208353145376442681299271802263625
84710659028389858250032342013320188801
---------------
from itertools import permutations
pan9s = [int(''.join(i)) for i in permutations('123456789')]
pan10s = [int(''.join(i)) for i in permutations('0123456789') if i[0] != '0']
sol9s = []
sol10s = []
for N in pan9s:
for P in range(2,51):
stringx = str(N**P)
if str(N) in stringx:
sol9s.append([N, P, N**P])
print(N, P, N**P)
break
for N in pan10s:
for P in range(2,51):
stringx = str(N**P)
if str(N) in stringx:
sol10s.append([N, P, N**P])
print(N, P, N**P)
|
Posted by Larry
on 2024-06-19 13:37:42 |