A177952 a(n) = number of n-digit squares in base 10 such that there is at least one permutation that is also a square in base 10. Initial zeros are not allowed for any square.
0, 0, 7, 13, 86, 293, 1212, 4699, 17380, 60623, 203799, 664953, 2135649, 6800449, 21572602, 68311990, 216144075, 683666674
Offset: 1
Examples
For instance, a(3) = 7 because (1) 144, 441 are both squares and permutations of each other as is 256, 625 and 169, 196, 961 and (2) there are no other 3 digit squares that can be permuted to another square (because initial zeros are forbidden, 100 and 001, etc., do not count).
Links
- R. Bilisoly, 92.45 Anasquares: Square anagrams of squares, The Mathematical Gazette, 92(2008), 58-63.
Crossrefs
a(n) converges to A049415 in the sense that the ratio of the two sequences goes to 1 as n goes to infinity.
Programs
-
Mathematica
nAnasquares[ndigits_] := Module[{nsquares = 0, nkeys = 0, nanapat = 0, upper, lower, square, key, dictionary}, lower = Sqrt[10^(ndigits - 1)] // Ceiling; upper = Sqrt[10^ndigits - 1] // Floor; Do[ ++nsquares; square = i^2; key = ToString[FromDigits[Sort[IntegerDigits[square]]]]; If[StringQ[ dictionary[ key]] && (Length[StringPosition[dictionary[key], ","]] == 0), ++nanapat, Null] If[StringQ[dictionary[key]], dictionary[key] = dictionary[key] <> "," <> ToString[square], dictionary[key] = ToString[square]; ++nkeys], {i, lower, upper}]; Return[nsquares - nkeys + nanapat] ] Table[nAnasquares[n], {n, 1, 10}]
Extensions
a(16)-a(18) from Donovan Johnson, Jun 10 2010
Comments