login
Nonsquares such that some permutation of digits is a square.
4

%I #18 Oct 18 2021 11:19:41

%S 10,18,40,46,52,61,63,90,94,106,108,112,136,148,160,163,180,184,205,

%T 211,234,243,250,252,259,265,279,295,297,298,306,316,342,360,406,409,

%U 414,418,423,432,448,460,478,481,487,490,502,520,522,526,562,567,592

%N Nonsquares such that some permutation of digits is a square.

%H Harvey P. Dale, <a href="/A007937/b007937.txt">Table of n, a(n) for n = 1..2500</a>

%H F. Smarandache, <a href="http://www.gallup.unm.edu/~smarandache/OPNS.pdf">Only Problems, Not Solutions!</a>, Xiquan Publ., Phoenix-Chicago, 1993.

%F A062892(a(n)) > 0.

%t Select[Range[600],!IntegerQ[Sqrt[#]]&&AnyTrue[FromDigits/@ Permutations[ IntegerDigits[ #]],IntegerQ[ Sqrt[#]]&]&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Aug 17 2020 *)

%o (Python)

%o from math import isqrt

%o from sympy.utilities.iterables import multiset_permutations as mp

%o def sqr(n): return isqrt(n)**2 == n

%o def ok(n):

%o if sqr(n): return False

%o s = str(n)

%o return any(sqr(int("".join(p))) for p in mp(s, len(s)))

%o print([k for k in range(600) if ok(k)]) # _Michael S. Branicky_, Oct 18 2021

%Y Cf. A000290, A062892, A096600.

%K nonn,base

%O 1,1

%A R. Muller

%E More terms from _Reinhard Zumkeller_, Jun 29 2004