login
Numbers k such that there are no palindromic squares of length k.
12

%I #25 Jun 14 2024 17:54:58

%S 2,4,8,10,14,18,20,24,30,38,40

%N Numbers k such that there are no palindromic squares of length k.

%C All terms are even since (10^k+1)^2 is a palindrome of length 2*k+1. a(12) >= 46 if it exists (see A263618). - _Chai Wah Wu_, Jun 14 2024

%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, A263618.

%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