%I #17 Jan 01 2024 11:56:08
%S 12,12,5,4,348,731,1001,1001,3747,6526,10001,3967,19365,29088,9436,
%T 53331,30484,72091,49255,30342,59579,52604,280501,88379,445885,452341,
%U 98107,755179,490404,126493,205417,170613,781944,821573,1808904,209732,1470036,559096,946969
%N a(n) is the smallest number k such that k^n has the same digits as some other n-th power without leading zeros.
%C The case where 10^n has the same digits as 1^n is excluded by no leading zeros constraint.
%H Chai Wah Wu, <a href="/A133208/b133208.txt">Table of n, a(n) for n = 1..105</a>
%e 12^2 = 144 - the same digits as 21^2 = 441.
%e 5^3 = 125 - the same digits as 8^3 = 512.
%e 4^4 = 256 - the same digits as 5^4 = 625.
%e 348^5 = 5103830227968 - the same digits as 381^5 = 8028323765901.
%o (Python)
%o from collections import Counter
%o def key(n):
%o c = Counter(str(n))
%o return tuple(c[i] for i in "0123456789")
%o def a(n):
%o j, jn, jkey, repeated = 1, 1, key(1), []
%o while not repeated:
%o d, ub = dict(), 10**(sum(jkey))
%o while jn <= ub:
%o if jkey not in d: d[jkey] = j
%o else: repeated.append(d[jkey])
%o j += 1
%o jn = j**n
%o jkey = key(jn)
%o return min(repeated)
%o print([a(n) for n in range(1, 25)]) # _Michael S. Branicky_, Dec 12 2021
%K base,nonn
%O 1,1
%A _Tanya Khovanova_, Oct 10 2007
%E a(6)-a(34) from _Donovan Johnson_, Apr 22 2008
%E a(35)-a(39) from _Chai Wah Wu_, Jun 01 2020
%E a(1) from _Chai Wah Wu_, Jun 02 2020
|