login
Digits of 2^n can be rearranged with no leading zeros to form t^2, for t not a power of 2.
2

%I #49 Aug 11 2021 01:30:21

%S 8,10,12,14,20,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,

%T 62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,

%U 106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150

%N Digits of 2^n can be rearranged with no leading zeros to form t^2, for t not a power of 2.

%C n has to be even, since odd powers of 2 are congruent to 2,5,8 mod 9, while squares are congruent to 0,1,4,7 mod 9, and two numbers whose digits are rearrangements of each other are congruent modulo 9.

%C Is it true that all sufficiently large even numbers appear in this list?

%C 22 is a term if leading zeros are allowed. 2^22 = 4194304 and 643^2 = 413449. - _Chai Wah Wu_, Aug 21 2020

%H Chai Wah Wu, <a href="/A337252/b337252.txt">Table of n, a(n) for n = 1..71</a>

%e Here are the squares corresponding to the first few powers of 2:

%e 2^8, 25^2

%e 2^10, 49^2

%e 2^12, 98^2

%e 2^14, 178^2

%e 2^20, 1028^2

%e 2^26, 8291^2

%e 2^28, 19112^2

%e 2^30, 33472^2

%e 2^32, 51473^2

%e 2^34, 105583^2

%e 2^36, 129914^2

%e 2^38, 640132^2

%e 2^40, 1081319^2

%e 2^42, 1007243^2

%e 2^44, 3187271^2

%e 2^46, 4058042^2

%e 2^48, 10285408^2

%e 2^50, 32039417^2

%e 2^52, 44795066^2

%e 2^54, 100241288^2

%e From _Robert Israel_, Aug 21 2020: (Start)

%e 2^56, 142847044^2

%e 2^58, 318068365^2 (End)

%e From _Chai Wah Wu_, Aug 21 2020: (Start)

%e 2^60, 1000562716^2

%e 2^62, 1000709692^2

%e 2^64, 3164169028^2

%e 2^66, 4498215974^2

%e 2^68, 10061077457^2

%e 2^70, 31624545442^2

%e 2^72, 34960642066^2

%e 2^74, 100786105136^2

%e 2^76, 105467328383^2

%e 2^78, 316579648042^2

%e 2^80, 1000556206526^2

%e 2^82, 1001129296612^2

%e 2^84, 3179799285956^2

%e 2^86, 3333501503458^2

%e 2^88, 10000006273742^2

%e 2^90, 31624717039768^2

%e 2^92, 31640399136637^2

%e 2^94, 100001179435324^2

%e 2^96, 100609261981363^2

%e 2^98, 316227945405958^2

%e 2^100, 1000000068136465^2

%e 2^102, 1000000012839623^2

%e 2^104, 3162279442052185^2

%e 2^106, 3162295238497457^2

%e 2^108, 10006109951303125^2

%e 2^110, 31622778376826465^2

%e 2^112, 31626290060004883^2

%e 2^114, 100005555418898327^2

%e 2^116, 100061093137010524^2

%e 2^118, 316229698532373214^2

%e 2^120, 1000000611139735223^2

%e 2^122, 1005540208662183694^2

%e 2^124, 3179814811220058566^2

%e 2^126, 9994442844707576056^2

%e 2^128, 31605185913938432804^2

%e 2^130, 31799720491491676612^2

%e 2^132, 99999944438762188450^2

%e 2^134, 316052017518707374894^2

%e 2^136, 100055595656929586657^2

%e 2^138, 316227783779026656472^2

%e 2^140, 3162277642424057210351^2

%e 2^142, 1000056109592630240914^2

%e 2^144, 3162279417006463372135^2

%e 2^146, 3162279434557126331437^2

%e 2^148, 10005559566228010636663^2

%e 2^150, 99999999444438629490484^2 (End)

%p filter:= proc(n) local L,X,S,t,s,x,b;

%p b:= 2^(n/2);

%p L:= sort(convert(2^n,base,10));

%p S:= map(t -> rhs(op(t)), [msolve(X^2=2^n,9)]);

%p for t from floor(10^((nops(L)-1)/2)/9) to floor(10^(nops(L)/2)/9) do

%p for s in S do

%p x:= 9*t+s;

%p if x = b then next fi;

%p if sort(convert(x^2,base,10))=L then return true fi;

%p od od;

%p false

%p end proc:

%p select(filter, [seq(i,i=2..58,2)]); # _Robert Israel_, Aug 21 2020

%o (Python)

%o from math import isqrt

%o def ok(n, verbose=True):

%o s = str(2**n)

%o L, target, hi = len(s), sorted(s), int("".join(sorted(s, reverse=True)))

%o if '0' not in s: lo = int("".join(target))

%o else:

%o lownzd, targetcopy = min(set(s) - {'0'}), target[:]

%o targetcopy.remove(lownzd)

%o rest = "".join(targetcopy)

%o lo = int(lownzd + rest)

%o for r in range(isqrt(lo), isqrt(hi)+1):

%o rr = r*r

%o if sorted(str(rr)) == target:

%o brr = bin(rr)[2:]

%o if brr != '1' + '0'*(len(brr)-1):

%o if verbose: print(f"2^{n}, {r}^2")

%o return r

%o return 0

%o print(list(filter(ok, range(2, 73, 2)))) # _Michael S. Branicky_, Aug 10 2021

%Y Cf. A069656, A235993, A337261.

%K nonn,base

%O 1,1

%A _Jeffrey Shallit_, Aug 21 2020

%E 56 and 58 added by _Robert Israel_, Aug 21 2020

%E a(23)-(68) from _Chai Wah Wu_, Aug 21 2020