%I #18 Feb 05 2021 00:21:24
%S 2,4,8,10,14,18,20,24,30,38,40
%N Numbers n such that there are no palindromic squares of length n.
%H Patrick De Geest, <a href="http://www.worldofnumbers.com/square.htm">Palindromic Squares</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PalindromicNumber.html">Palindromic Number</a>
%t A034822[n_] := Select[Range[Ceiling[Sqrt[10^(n - 1)]], Floor[Sqrt[10^n]]], #^2 == IntegerReverse[#^2] &];
%t Select[Range[12], Length[A034822[#]] == 0 &] (* _Robert Price_, Apr 23 2019 *)
%o (Python)
%o from sympy import integer_nthroot as iroot
%o def ispal(n): s = str(n); return s == s[::-1]
%o def ok(n):
%o for r in range(iroot(10**(n-1), 2)[0] + 1, iroot(10**n, 2)[0]):
%o if ispal(r*r): return False
%o return True
%o print([m for m in range(1, 16) if ok(m)]) # _Michael S. Branicky_, Feb 04 2021
%Y Cf. A002778, A002779, A034307.
%K nonn,base,hard,more
%O 1,1
%A _Patrick De Geest_, Oct 15 1998
%E Two more terms from _Patrick De Geest_, Apr 01 2002
|