cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A027829 Palindromic squares with an even number of digits.

Original entry on oeis.org

698896, 637832238736, 4099923883299904, 6916103777337773016196, 40460195511188111559106404, 4872133543202112023453312784, 9658137819052882509187318569, 46501623417708833880771432610564, 1635977102407987117897042017795361, 163296619873968186681869378916692361
Offset: 1

Views

Author

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

Keywords

Examples

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

References

  • 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]

Crossrefs

Programs

  • Mathematica
    Select[Range[1000000]^2, PalindromeQ[#] && OddQ[Floor[Log[10, #]]] &] (* Alonso del Arte, Oct 11 2019 *)
  • 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
    
  • Python
    from math import isqrt
    from itertools import count, islice
    def A027829_gen(): # generator of terms
        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))))
    A027829_list = list(islice(A027829_gen(),3)) # Chai Wah Wu, Jun 23 2022
  • Scala
    def isPalindromic(n: BigInt): Boolean = n.toString == n.toString.reverse
    val squares = ((1: BigInt) to (1000000: BigInt)).map(n => n * n)
    squares.filter(n => isPalindromic(n) && n.toString.length % 2 == 0) // Alonso del Arte, Oct 07 2019
    

Formula

a(n) = A016113(n)^2. - M. F. Hasler, Jun 08 2014

Extensions

Two new terms were recently found by Bennett from UK (communication from Patrick De Geest, Dec 1999 or before)
Edited by M. F. Hasler, Jun 08 2014