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-3 of 3 results.

A002779 Palindromic squares.

Original entry on oeis.org

0, 1, 4, 9, 121, 484, 676, 10201, 12321, 14641, 40804, 44944, 69696, 94249, 698896, 1002001, 1234321, 4008004, 5221225, 6948496, 100020001, 102030201, 104060401, 121242121, 123454321, 125686521, 400080004, 404090404, 522808225
Offset: 1

Views

Author

Keywords

Comments

These are numbers that are both squares (see A000290) and palindromes (see A002113).

Examples

			676 is included because it is both a perfect square and a palindrome.
		

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

Programs

  • Haskell
    a002779 n = a002778_list !! (n-1)
    a002779_list = filter ((== 1) . a136522) a000290_list
    -- Reinhard Zumkeller, Oct 11 2011
    
  • Magma
    [k^2:k in [0..100000]| Intseq(k^2) eq Reverse(Intseq(k^2)) ]; // Marius A. Burtea, Oct 15 2019
    
  • Mathematica
    palindromicNumberQ = ((# // IntegerDigits // Reverse // FromDigits) == #) &; Select[Table[n^2, {n, 0, 9999}],  palindromicNumberQ] (* Herman Beeksma, Jul 14 2005 *)
    pb10Q[n_] := Module[{idn10 = IntegerDigits[n, 10]}, idn10 == Reverse[idn10]]; Select[Range[0, 19999]^2, pb10Q] (* Vincenzo Librandi, Jul 24 2014 *)
    Select[Range[0, 22999]^2, PalindromeQ] (* Requires Mathematica version 10 or later. - Harvey P. Dale, May 01 2017 *)
  • PARI
    is(n)=my(d=digits(n)); d==Vecrev(d) && issquare(n) \\ Charles R Greathouse IV, Feb 06 2017
    
  • Python
    A002779_list = [int(s) for s in (str(m**2) for m in range(10**5)) if s == s[::-1]] # Chai Wah Wu, Aug 26 2021
  • Scala
    def isPalindromic(n: BigInt): Boolean = n.toString == n.toString.reverse
      val squares = ((1: BigInt) to (1000000: BigInt)).map(n => n * n)
      squares.filter(isPalindromic()) // _Alonso del Arte, Oct 07 2019
    

Formula

From Reinhard Zumkeller, Oct 11 2011: (Start)
a(n) = A002778(n)^2.
A136522(A000290(a(n))) = 1.
A010052(a(n)) * A136522(a(n)) = 1. (End)

A016113 Numbers whose square is a palindrome with an even number of digits.

Original entry on oeis.org

836, 798644, 64030648, 83163115486, 6360832925898, 69800670077028, 98275825201587, 6819209882215742, 40447213778058769, 404099764753665981, 633856150760638652, 795559265009384106, 637323988797048057098, 3823177109095314778621
Offset: 1

Views

Author

Keywords

Comments

For the squares, see A027829(n) = a(n)^2. - M. F. Hasler, Oct 11 2019

References

  • C. 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

A proper subset of A002778.
Cf. A027829.

Programs

  • PARI
    is_A016113(n)={Vecrev(n=digits(n^2))==n&&!bittest(#n,0)} \\ This is faster than first checking for even length, if applied to numbers in a range where the squares are known to have an even number of digits, as should be the case for a systematic search. - M. F. Hasler, Jun 08 2014

Extensions

Two terms were found by Bennett from UK (communication from Patrick De Geest)
Edited by M. F. Hasler, Jun 08 2014
Missing a(10) inserted by M. F. Hasler, Oct 11 2019

A354256 Squares that remain square when written backward, are not divisible by 10, and have an even number of digits.

Original entry on oeis.org

1089, 9801, 698896, 10036224, 42263001, 637832238736, 1021178969603881, 1883069698711201, 4099923883299904, 6916103777337773016196
Offset: 1

Views

Author

Jon E. Schoenfield, May 21 2022

Keywords

Comments

a(10) > 10^21.
Is this sequence infinite?
Every term is a multiple of 121.
Terms come in nonpalindromic pairs and palindromic singles; see Example section.
Removal of the "even number of digits" requirement yields A033294, which has 8560 terms < 10^20.
A027829 is a subsequence. - Chai Wah Wu, May 23 2022

Examples

			There are no 2-digit terms.
The smallest 4-digit multiple of 121 is 1089 = 33^2, which happens to be a(1); its digit reversal is a(2) = 9801 = 99^2.
The only 6-digit term is the palindrome a(3) = 698896 = 836^2.
The only 8-digit terms are a(4) = 10036224 = 3168^2 and its digit reversal a(5) = 42263001 = 6501^2.
There are no 10-digit terms.
The only 12-digit term is the palindrome a(6) = 637832238736 = 798644^2.
There are no 14-digit terms.
There are three 16-digit terms: a(7) = 1021178969603881 = 31955891^2, its digit reversal a(8) = 1883069698711201 = 43394351^2, and the palindrome a(9) = 4099923883299904 = 64030648^2.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[500000]^2,EvenQ[IntegerLength[#]]&&Mod[#,10]!=0&&IntegerQ[Sqrt[ IntegerReverse[ #]]]&] (* The program generates the first five terms of the sequence. *) (* Harvey P. Dale, Jul 28 2024 *)
  • Python
    from math import isqrt
    from itertools import count, islice
    def sqr(n): return isqrt(n)**2 == n
    def agen(): yield from (k*k for k in count(1) if k%10 and len(s:=str(k*k))%2==0 and sqr(int(s[::-1])))
    print(list(islice(agen(), 6))) # Michael S. Branicky, May 23 2022
    
  • Python
    from math import isqrt
    from itertools import count, islice
    from sympy import integer_nthroot
    def A354256_gen(): # generator of terms
        for l in count(2,2):
            for m in (1,4,5,6,9):
                for k in range(1+isqrt(m*10**(l-1)-1),1+isqrt((m+1)*10**(l-1)-1)):
                    if k % 10 and integer_nthroot(int(str(k*k)[::-1]),2)[1]:
                        yield k*k
    A354256_list = list(islice(A354256_gen(),9)) # Chai Wah Wu, May 23 2022

Extensions

a(10) from Chai Wah Wu, May 24 2022
Showing 1-3 of 3 results.