login
Perfect squares k such that each decimal digit of k is equal to the difference of at least two other digits of k.
4

%I #19 Mar 12 2015 11:19:33

%S 59049,60516,91809,130321,131044,150544,199809,255025,299209,396900,

%T 656100,660969,670761,774400,811801,998001,1018081,1022121,1089936,

%U 1188100,1212201,1452025,1585081,1677025,1697809,1760929,2047761,2056356,2064969,2155024,2205225

%N Perfect squares k such that each decimal digit of k is equal to the difference of at least two other digits of k.

%C Let x(1)x(2)... x(q-1)x(q) denote the decimal expansion of a square k. The sequence lists the squares k such that, for each index i, x(i) = x(u) - x(v) for some indices u and v. Each term of the sequence contains at least two identical decimal digits and at least one 0 digit.

%C Subsequence of A255966.

%C The number 10948273956 is the smallest square of the sequence containing 10 distinct digits.

%H Michel Lagneau, <a href="/A255893/b255893.txt">Table of n, a(n) for n = 1..10000</a>

%e 59049 is in the sequence because:

%e 5 = 9 - 4;

%e 9 = 9 - 0;

%e 0 = 9 - 9;

%e 4 = 9 - 5;

%e 9 = 9 - 0.

%p with(numtheory):

%p for m from 10 to 10000 do:

%p n:=m^2:x:=convert(n,base,10):n1:=nops(x):c:=0:T:=array(1..n1-1):

%p for nn from 1 to n1 do:

%p z:=x[nn]:

%p k:=0:

%p for j from 1 to n1 do:

%p if nn<>j

%p then

%p k:=k+1:T[k]:=x[j]:

%p else

%p fi:

%p od:

%p ii:=0:

%p for a from 1 to n1-1 while(ii=0) do:

%p for b from a+1 to n1-1 while(ii=0) do:

%p if z=abs(T[a]-T[b]) then ii:=1:c:=c+1:

%p else

%p fi:

%p od:od:

%p od:

%p if c=n1 then printf(`%d, `,n):

%p else

%p fi:

%p od:

%t fQ[n_] := Block[{id = IntegerDigits@ n, lng = 1 + Floor@ Log10@ n}, Union@ Table[c = Complement[ Range@ lng, {i}]; MemberQ[ Union@ Flatten@ Table[Abs[id[[j]] - id[[k]]], {j, c}, {k, c}], id[[i]]], {i, lng}] == {True}]; Select[ Range@ 1450^2, fQ] (* _Robert G. Wilson v_, Mar 10 2015 *)

%Y Cf. A255892, A255893, A255917, A255966.

%K nonn,base

%O 1,1

%A _Michel Lagneau_, Mar 09 2015