%I #9 Jun 14 2017 00:57:30
%S 144,196,256,441,625,961,11664,14884,16384,16641,25600,36864,38416,
%T 46656,48841,60025,61009,66564,86436,96100,166464,214369,216225,
%U 236196,272484,364816,436921,481636,622521,646416,842724,870489,898704,962361
%N Squares such that another square can be obtained by a cyclic permutation of the digits, excluding leading zeros.
%C This is a subsequence of A034289.
%C It seems that there are never more than two squares having the same digits up to a cyclic permutation (checked up to (10^8)^2).
%H M. F. Hasler, <a href="/A135780/b135780.txt">Table of n, a(n) for n = 1..816</a>
%e a(1) = 144 = 12^2 is the least square such that a cyclic permutation of its decimal digits is again a square, namely 441 = 21.
%e a(2) = 196 = 14^2 is the second least square having this property, with 961 = 19^2.
%e A034289(2)=169 does not figure here, since the permutations of its digits yielding squares are 196 and 961, which are not cyclic permutations of 169.
%e The number 25600 is here since 60025 is also a square.
%e The fact that 00256 also is a square is irrelevant: permutations with leading zeros are not considered.
%t scpQ[n_]:=Module[{idn=IntegerDigits[n],r},r=DeleteCases[Rest[ NestList[ RotateRight[ #]&,IntegerDigits[ n],IntegerLength[n]-1]],_?(First[#] == 0&)];AnyTrue[FromDigits/@r,IntegerQ[Sqrt[#]]&]]; Select[Range[ 1000]^2, scpQ] (* This program uses the AnyTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Aug 21 2014 *)
%o (PARI) for(n=1,10^8,(t=n^2)/* %10 || next <= this would exclude terms with trailing '0's */; found=0; for(j=1,k=#Str(t)-1, t=divrem(t,10);t[2] || (t=t[1]) && next /* <= this excludes leading '0's */; issquare(t=t[1]+10^k*t[2]) || next; /* t%10 || next; <= would exclude permutations with trailing '0's */ print1( if(found,"<<<"/* mark multiple permutations: this never happens */,found=1;n^2)",")))
%Y Cf. A034289 (allowing arbitrary permutations), A135770.
%K base,easy,nonn,nice
%O 1,1
%A _David W. Wilson_ and _M. F. Hasler_, Jan 09 2008
|