login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A027829 Palindromic squares with an even number of digits. 4

%I #40 Jun 24 2022 05:22:08

%S 698896,637832238736,4099923883299904,6916103777337773016196,

%T 40460195511188111559106404,4872133543202112023453312784,

%U 9658137819052882509187318569,46501623417708833880771432610564,1635977102407987117897042017795361,163296619873968186681869378916692361

%N Palindromic squares with an even number of digits.

%D Charles Ashbacher, More on palindromic squares, J. Rec. Math. 22, no. 2 (1990), 133-135. [A scan of the first page of this article is included with the last page of the Keith (1990) scan]

%H M. F. Hasler, <a href="/A027829/b027829.txt">Table of n, a(n) for n = 1..14</a>

%H K. S. Brown, <a href="http://www.mathpages.com/home/kmath359.htm">On General Palindromic Numbers</a>

%H Patrick De Geest, <a href="http://www.worldofnumbers.com/square.htm">Palindromic Squares</a>

%H Patrick De Geest, <a href="http://www.worldofnumbers.com/subsquar.htm">Subsets of Palindromic Squares</a>

%H Michael Keith, <a href="/A002778/a002778_1.pdf">Classification and enumeration of palindromic squares</a>, J. Rec. Math., 22 (No. 2, 1990), 124-132. [Annotated scanned copy]

%F a(n) = A016113(n)^2. - _M. F. Hasler_, Jun 08 2014

%e 836^2 = 698896, which is palindromic, so 698896 is in the sequence.

%e 1001^2 = 1002001, which is palindromic, but it has an odd number of digits, so it's not in the sequence.

%t Select[Range[1000000]^2, PalindromeQ[#] && OddQ[Floor[Log[10, #]]] &] (* _Alonso del Arte_, Oct 11 2019 *)

%o (PARI) is_A027829(n)={issquare(n)&&Vecrev(n=digits(n))==n&&!bittest(#n, 0)} \\ This is faster than first checking for even length if applied to numbers known to have an even number of digits, as should be the case for a systematic search. For this, one should only consider squares, i.e., rather use is_A016113. - _M. F. Hasler_, Jun 08 2014

%o (Scala) def isPalindromic(n: BigInt): Boolean = n.toString == n.toString.reverse

%o val squares = ((1: BigInt) to (1000000: BigInt)).map(n => n * n)

%o squares.filter(n => isPalindromic(n) && n.toString.length % 2 == 0) // _Alonso del Arte_, Oct 07 2019

%o (Python)

%o from math import isqrt

%o from itertools import count, islice

%o def A027829_gen(): # generator of terms

%o return filter(lambda n: (s:=str(n))[:(t:=(len(s)+1)//2)]==s[:-t-1:-1], map(lambda n: n**2, (d for l in count(2,2) for d in range(isqrt(10**(l-1))+1,isqrt(10**l)+1))))

%o A027829_list = list(islice(A027829_gen(),3)) # _Chai Wah Wu_, Jun 23 2022

%Y Cf. A002113, A002778, A002779, A016113.

%K nonn,base

%O 1,1

%A Keith Devlin, via Boon Leong (boon_leong(AT)hotmail.com)

%E Two new terms were recently found by Bennett from UK (communication from _Patrick De Geest_, Dec. 1999 or before)

%E Edited by _M. F. Hasler_, Jun 08 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 13:40 EDT 2024. Contains 371792 sequences. (Running on oeis4.)