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.

Showing 1-4 of 4 results.

A002778 Numbers whose square is a palindrome.

Original entry on oeis.org

0, 1, 2, 3, 11, 22, 26, 101, 111, 121, 202, 212, 264, 307, 836, 1001, 1111, 2002, 2285, 2636, 10001, 10101, 10201, 11011, 11111, 11211, 20002, 20102, 22865, 24846, 30693, 100001, 101101, 110011, 111111, 200002, 798644, 1000001, 1001001
Offset: 1

Views

Author

Keywords

Comments

A002779(n) = a(n)^2; A136522(A000290(a(n))) = 1. - Reinhard Zumkeller, Oct 11 2011
See A016113 for the subset of numbers whose palindromic squares have an even number of digits. - M. F. Hasler, Jun 08 2014

Examples

			26^2 = 676, which is a palindrome, so 26 is in the sequence.
27^2 = 729, which is not a palindrome, so 27 is not in the sequence.
		

References

  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See A003166 for binary analog.
For analogs in bases 2,3,4,5,etc. see A003166 onwards, A029984 onwards, and A263607 onwards.

Programs

  • Haskell
    a002778 n = a002778_list !! (n-1)
    a002778_list = filter ((== 1) . a136522 . (^ 2)) [0..]
    -- Reinhard Zumkeller, Oct 11 2011
    
  • Magma
    [n: n in [0..2*10^6] | Intseq(n^2) eq Reverse(Intseq(n^2))]; // Vincenzo Librandi, Apr 07 2015
    
  • Mathematica
    palsquareQ[n_] := (n2 = IntegerDigits[n^2]; n2 == Reverse[n2]); A002778 = {}; Do[ If[palsquareQ[n], Print[n]; AppendTo[A002778, n]], {n, 0, 2 * 10^6}]; A002778 (* Jean-François Alcover, Dec 01 2011 *)
    Sqrt[#]&/@Select[Range[0, 12 * 10^5]^2, # == IntegerReverse[#] &] (* The program uses the IntegerReverse function from Mathematica version 10. - Harvey P. Dale, Mar 04 2016 *)
    Select[Range[0, 1001001], PalindromeQ[#^2] &] (* Michael De Vlieger, Dec 06 2017 *)
  • PARI
    is_A002778(n)=is_A002113(n^2) \\ M. F. Hasler, Jun 08 2014
    
  • Python
    from itertools import count, islice
    def A002778_gen(): # generator of terms
        return filter(lambda k: (s:=str(k**2))[:(t:=(len(s)+1)//2)]==s[:-t-1:-1],count(0))
    A002778_list = list(islice(A002778_gen(),20)) # Chai Wah Wu, Jun 23 2022

Extensions

More terms from Patrick De Geest

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

A065378 Primes p such that p^2 is a palindromic square.

Original entry on oeis.org

2, 3, 11, 101, 307, 30001253, 100111001, 110111011, 111010111, 111091111, 1011099011101, 1100011100011, 1100101010011, 1101010101011, 100110101011001, 100110990111001, 101000010000101, 101011000110101, 101110000011101
Offset: 1

Views

Author

Patrick De Geest, Nov 03 2001

Keywords

Comments

Record prime base number of a sporadic palindromic square is 13661181333262459.

Examples

			E.g. a(6) = 900075181570009 = p^2 with p = 30001253 and prime.
		

Crossrefs

Programs

  • Mathematica
    t={}; Do[p=Prime[n]; If[FromDigits[Reverse[IntegerDigits[p^2]]]==p^2,AppendTo[t,p]],{n,10^7}]; t (* Jayanta Basu, May 11 2013 *)

Extensions

Corrected by Jayanta Basu, May 11 2013

A065379 Palindromic squares with a prime root.

Original entry on oeis.org

4, 9, 121, 10201, 94249, 900075181570009, 12124434743442121, 12323244744232321, 12341234943214321, 1022321210249420121232201, 1210024420147410244200121, 1210222232227222322220121
Offset: 1

Views

Author

Patrick De Geest, Nov 03 2001

Keywords

Comments

Record sporadic palindromic square with a prime root is 186627875420278656872024578726681.

Examples

			a(6) = 900075181570009 = p^2 with p = 30001253, a prime.
		

Crossrefs

Showing 1-4 of 4 results.