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

A057136 Palindromes whose square root is a palindrome.

Original entry on oeis.org

0, 1, 4, 9, 121, 484, 10201, 12321, 14641, 40804, 44944, 1002001, 1234321, 4008004, 100020001, 102030201, 104060401, 121242121, 123454321, 125686521, 400080004, 404090404, 10000200001, 10221412201, 12102420121, 12345654321, 40000800004
Offset: 1

Views

Author

Henry Bottomley, Aug 12 2000

Keywords

Comments

Always contain an odd number of digits.

Examples

			a(8) = 14641 since 14641 = 121^2 and 121 is also a palindrome
		

Crossrefs

Cf. A000290, A002113, A002779, A057135 (the square roots).

Programs

  • Maple
    dmax:= 7: # to get all terms with up to dmax digits
    Res:= 0,1,2^2,3^2,11^2,22^2:
    Po:= [[0],[1],[2],[3]]: Pe:= [[0,0],[1,1],[2,2]]:
    for d from 1 to dmax do
      if d::odd then
        Po:= select(t -> add(s^2,s=t) < 10, [seq(seq([i,op(t),i], t=Po),i=0..2)]);
        Res:= Res, op(map(proc(p) if p[1] <> 0 then add(p[i]*10^(i-1),i=1..nops(p))^2 fi end proc, Po))
      else
        Pe:= select(t -> add(s^2,s=t) < 10, [seq(seq([i,op(t),i], t=Pe),i=0..2)]);
        Res:= Res, op(map(proc(p) if p[1] <> 0 then add(p[i]*10^(i-1),i=1..nops(p))^2 fi end proc, Pe))
      fi;
    od:
    Res; # Robert Israel, Jun 21 2017
  • Mathematica
    Select[Range[0, 10^6], PalindromeQ[#] && PalindromeQ[#^2] &]^2 (* Robert Price, Apr 26 2019 *)

Formula

a(n) = A057135(n)^2

A128921 Palindromes m such that reverse of m^2 is also a square.

Original entry on oeis.org

0, 1, 2, 3, 11, 22, 33, 99, 101, 111, 121, 202, 212, 1001, 1111, 2002, 10001, 10101, 10201, 11011, 11111, 11211, 20002, 20102, 100001, 101101, 110011, 111111, 200002, 1000001, 1001001, 1002001, 1010101, 1011101, 1012101, 1100011, 1101011
Offset: 1

Views

Author

Zak Seidov, Mar 02 2005, definition corrected Sep 16 2007

Keywords

Comments

Most terms have a palindromic square; for the rare exceptions see A133901. - Klaus Brockhaus and Zak Seidov, Sep 29 2007

Examples

			33 and 99 are terms because 33^2=1089 => 9801=99^2 and 99^2=9801 => 1089=33^2.
		

Crossrefs

Programs

  • Mathematica
    A128921=Select[Range[0, 100000], IntegerQ[Sqrt[FromDigits[Reverse[IntegerDigits[ #^2 ]]]]]&&FromDigits[Reverse[IntegerDigits[ # ]]]==#&]
  • Python
    from sympy.ntheory.primetest import is_square
    from itertools import chain, count, islice
    def A128921_gen(): # generator of terms
        return filter(lambda n:is_square(int(str(n**2)[::-1])),chain((0,),chain.from_iterable(chain((int((s:=str(d))+s[-2::-1]) for d in range(10**l,10**(l+1))), (int((s:=str(d))+s[::-1]) for d in range(10**l,10**(l+1)))) for l in count(0))))
    A128921_list = list(islice(A128921_gen(),20)) # Chai Wah Wu, Jun 23 2022

Extensions

More terms from Klaus Brockhaus, Sep 23 2007

A218035 Number of n-digit palindromes with squares that are also palindromes.

Original entry on oeis.org

4, 2, 5, 3, 8, 5, 13, 9, 22, 16, 37, 27, 60, 43, 93, 65, 138, 94, 197, 131, 272, 177, 365, 233, 478, 300, 613, 379, 772, 471, 957, 577, 1170, 698, 1413, 835, 1688, 989, 1997, 1161, 2342, 1352, 2725, 1563, 3148, 1795, 3613, 2049, 4122, 2326, 4677, 2627, 5280, 2953
Offset: 1

Views

Author

David Zvirbulis, Oct 19 2012

Keywords

Comments

Number of n-digit terms in A057135.
From Chai Wah Wu, Apr 03 2021: (Start)
The conjectures in the formula section are true.
Theorem: a(n) = (n^3-6*n^2+32*n+48)/48 if n is even.
a(n) = (n^3-9*n^2+59*n-3)/24 if n > 1 is odd.
Proof: For n < 9, this is true by inspection.
The set of palindromes whose square are palindromic are the numbers whose squares of the digits sums to less than 10 (see A057135). For n >= 9, the nonzero digits are from one of the following 12 sets:
(1, 1, 1, 1, 1, 1, 1, 1), (1, 2, 2), (1, 1, 1, 1), (1, 1, 2), (1, 1, 1, 1, 1, 1, 1), (1, 1, 1, 1, 1, 1, 1, 1, 1), (2, 2), (1, 1, 1), (1, 1, 1, 1, 1), (1, 1), (1, 1, 1, 1, 2), (1, 1, 1, 1, 1, 1)
For odd n >= 9:
(1, 1, 1, 1, 1, 1, 1, 1): number of palindromes with 8 1's and n-8 0's is C((n-3)/2,3) = (n-3)(n-5)(n-7)/48. This is because all palindromes must start and end with a nonzero digit and the middle digit is necessarily 0, so only the (n-3) remaining digits are permuted with 6 1's and (n-9) 0's. By symmetry of the palindromes the number of combinations is C((n-3)/2,3).
(1, 2, 2): 1 palindrome of the form 20..010..2.
(1, 1, 1, 1): number of palindromes with 4 1's and n-4 0's is C((n-3)/2,1) = (n-3)/2.
(1, 1, 2): 1 palindrome of the form 10..020..1.
(1, 1, 1): 1 palindrome of the form 10..010..1.
(1, 1, 1, 1, 1): number of palindromes with 5 1's and n-5 0's is C((n-3)/2,1) = (n-3)/2.
(1, 1, 1, 1, 2): C((n-3)/2,1) = (n-3)/2.
(1, 1, 1, 1, 1, 1, 1): C((n-3)/2,2).
(1, 1, 1, 1, 1, 1, 1, 1, 1): C((n-3)/2,3).
(2,2): 1 palindrome of the form 200...002.
(1,1): 1 palindrome of the form 100...001.
(1,1,1,1,1,1): number of palindromes with 6 1's and n-6 0's is C((n-3)/2,2) = (n-3)(n-5)/8.
Thus A218035(n) = 2*(n-3)(n-5)(n-7)/48 +2*(n-3)(n-5)/8 +3*(n-3)/2 + 5 = (n^3-9n^2+59n-3)/24.
For even n >= 9:
(1, 2, 2), (1, 1, 2), (1, 1, 1), (1, 1, 1, 1, 1), (1, 1, 1, 1, 2), (1, 1, 1, 1, 1, 1, 1), (1, 1, 1, 1, 1, 1, 1, 1, 1): no palindromes are possible.
(1, 1, 1, 1, 1, 1, 1, 1): number of palindromes 8 1's and n-8 0's = C((n-2)/2,3) = (n-2)(n-4)(n-6)/48.
(1, 1, 1, 1): number of palindromes with 4 1's and n-4 0's is C((n-2)/2,1) = (n-2)/2.
(2,2): 1 palindrome of the form 200...002.
(1,1): 1 palindrome of the form 100...001.
(1,1,1,1,1,1): number of palindromes with 6 1's and n-6 0's is C((n-2)/2,2) = (n-2)(n-4)/8.
Thus A218035(n) = (n-2)(n-4)(n-6)/48 + (n-2)(n-4)/8 + (n-2)/2 +2 = (n^3-6n^2+32n+48)/48. QED
(End)

Examples

			For n=4, the solutions are:
1001, 1001^2 = 1002001,
1111, 1111^2 = 1234321,
2002, 2002^2 = 4008004.
		

Crossrefs

Programs

  • Python
    from itertools import product
    def ispal(n): s = str(n); return s == s[::-1]
    def pals(n):
      midrange = [[""], [str(i) for i in range(10)]]
      for p in product("0123456789", repeat=n//2):
        left = "".join(p)
        if len(left) and left[0] == '0': continue
        for middle in midrange[n%2]: yield left+middle+left[::-1]
    def a(n): return sum(ispal(int(strpal)**2) for strpal in pals(n))
    print([a(n) for n in range(1, 13)]) # Michael S. Branicky, Apr 02 2021
    
  • Python
    def A218035(n): return 4 if n == 1 else (n**3-9*n**2+59*n-3)//24 if n % 2 else (n**3-6*n**2+32*n+48)//48 # Chai Wah Wu, Apr 03 2021

Formula

Conjecture: a(n) = n^3/48 - n^2/8 + 2n/3 + 1 if n even, see A011826.
Conjecture: a(n) = n^3/24 - 3n^2/8 + 59n/24 - 1/8 if n odd, n > 1.
From Chai Wah Wu, Apr 03 2021: (Start)
a(n) = 4*a(n-2) - 6*a(n-4) + 4*a(n-6) - a(n-8) for n > 9.
G.f.: x*(2*x^8 - x^7 - 5*x^6 + 5*x^5 + 12*x^4 - 5*x^3 - 11*x^2 + 2*x + 4)/((x - 1)^4*(x + 1)^4). (End)

Extensions

a(19)-a(20) from Michael S. Branicky, Apr 02 2021
More terms from Chai Wah Wu, Apr 03 2021

A133901 Numbers in A128921 whose square is not a palindrome.

Original entry on oeis.org

33, 99, 1119111, 10110901101, 11110901111, 101109901101, 1011109011101, 1110109010111, 10111099011101, 100110090011001, 100111090111001, 101011090110101, 111001090100111
Offset: 1

Views

Author

Klaus Brockhaus and Zak Seidov, Sep 29 2007

Keywords

Comments

Also terms of A128921 that do not consist completely of digits 0, 1, 2, however excluding A128921(4) = 3.
Conjecture: Sequence is infinite.

Examples

			A128921(41) = 1119111, 1119111^2 = 1252409430321 is not a palindrome, but its reverse is also a square: 1230349042521 = 1109211^2.
		

Crossrefs

Cf. A128921 (palindromes p such that reverse of p^2 is also a square), A002113 (palindromes in base 10), A057135 (palindromes whose square is a palindrome), A057136 (palindromes whose square root is a palindrome).

A225603 Palindromic primes whose square is also a palindrome.

Original entry on oeis.org

2, 3, 11, 101, 100111001, 110111011, 111010111, 1100011100011, 1100101010011, 1101010101011, 100110101011001, 101000010000101, 101011000110101, 101110000011101, 10000010101000001, 10011010001011001, 10100110001100101, 10110010001001101, 10111000000011101
Offset: 1

Views

Author

Jayanta Basu, May 11 2013

Keywords

Comments

Subsets of A002385, A057135 and A065378.
Palindromes in A161721. Conjecture: a(n) for n >=3 consists only of the digits 0,1. - Chai Wah Wu, Jan 06 2015

Examples

			101 is a member since it is a palindromic prime such that 101^2=10201 is a palindrome.
		

Crossrefs

Programs

  • Mathematica
    palQ[n_]:=FromDigits[Reverse[IntegerDigits[n]]]==n; t={}; Do[If[palQ[p=Prime[n]] && palQ[p^2],AppendTo[t,p]],{n,10^7}]; t
  • Python
    from _future_ import division
    from sympy import isprime
    def paloddgenrange(t,l,b=10): # generator of odd-length palindromes in base b of 2*t <=length <= 2*l
        if t == 0:
            yield 0
        else:
            for x in range(t+1,l+1):
                n = b**(x-1)
                n2 = n*b
                for y in range(n,n2):
                    k, m = y//b, 0
                    while k >= b:
                        k, r = divmod(k,b)
                        m = b*m + r
                    yield y*n + b*m + k
    A225603_list = [2,3,11]
    for i in paloddgenrange(1,10):
        s = str(i*i)
        if s == s[::-1] and isprime(i):
            A225603_list.append(i) # Chai Wah Wu, Jan 06 2015

Extensions

a(15)-a(19) from Giovanni Resta, May 11 2013

A241096 Palindromes in base 16 whose squares are also palindromes.

Original entry on oeis.org

1, 2, 3, 11, 22, 101, 111, 121, 131, 202, 212, 222, 1001, 1111, 1221, 2002, 2112, 10001, 10101, 10201, 10301, 11011, 11111, 11211, 11311, 12021, 12121, 12221, 20002, 20102, 20202, 21012, 21112, 21212, 100001, 101101, 102201, 110011, 111111, 112211, 120021
Offset: 1

Views

Author

J. Lowell, Apr 26 2014

Keywords

Examples

			131 is a term of this sequence because (unlike in base 10, where squaring 131 carries a 1 into the thousands place so that 131^2 is the non-palindromic number 17161) in base 16, 131^2 is 16B61.
141 is not a term because, even in base 16, a 1 is carried into the next place, so the result (19281) is not palindromic.
		

Crossrefs

Cf. A057135.

Programs

  • Sage
    L=[]
    for x in [1..100000]:
        M=x.digits(base=16)
        N=M[::-1]
        if N == M:
            d=x^2
            D=d.digits(base=16)
            E=D[::-1]
            if D == E:
                MM=(str(x) for x in M)
                L.append(Integer(''.join(MM)))
    L # Tom Edgar, Apr 29 2014

Extensions

a(35)-a(41) from Lars Blomberg, Oct 23 2014

A343098 Number of palindromes < 10^n whose squares are also palindromes.

Original entry on oeis.org

1, 4, 6, 11, 14, 22, 27, 40, 49, 71, 87, 124, 151, 211, 254, 347, 412, 550, 644, 841, 972, 1244, 1421, 1786, 2019, 2497, 2797, 3410, 3789, 4561, 5032, 5989, 6566, 7736, 8434, 9847, 10682, 12370, 13359, 15356, 16517, 18859, 20211, 22936, 24499, 27647, 29442, 33055
Offset: 0

Views

Author

Chai Wah Wu, Apr 04 2021

Keywords

Comments

Partial sum of A218035. Number of terms in A057135 < 10^n.

Examples

			a(2) = 6 since the only palindromes < 100 whose square are palindromes are 0,1,2,3,11,22.
		

Crossrefs

Programs

Formula

a(n) = #{i:A057135(i)<10^n}.
For n > 0, a(n) = Sum_{i=1..n} A218035(i).
a(n) = a(n-1) + 4*a(n-2) - 4*a(n-3) - 6*a(n-4) + 6*a(n-5) + 4*a(n-6) - 4*a(n-7) - a(n-8) + a(n-9) for n > 9.
G.f.: (-x^9 + x^7 - x^6 - 6*x^5 - x^4 + 7*x^3 + 2*x^2 - 3*x - 1)/((x - 1)^5*(x + 1)^4).
a(n) = 1491 + 904*n + 510*n^2 - 52*n^3 + 6*n^4 + (-1)^n * (45 - 296*n + 42*n^2 - 4*n^3) for n>0. - Greg Dresden, Jun 20 2021

A348429 Perfect powers m^k, m >= 1, k >= 2 such that m and m^k both are palindromes.

Original entry on oeis.org

1, 4, 8, 9, 121, 343, 484, 1331, 10201, 12321, 14641, 40804, 44944, 1002001, 1030301, 1234321, 1367631, 4008004, 100020001, 102030201, 104060401, 121242121, 123454321, 125686521, 400080004, 404090404, 1003003001, 10000200001, 10221412201, 12102420121, 12345654321, 40000800004
Offset: 1

Views

Author

Bernard Schott, Oct 18 2021

Keywords

Comments

Complement of A348319 relative to the positive perfect powers A001597.
This sequence is infinite since each square (10^m+1)^2 is a term for m >= 0 and A033934 is a subsequence.
Observation: terms always contain an odd number of digits.
For k = 2, subsequence of palindromes whose square root is a palindrome is A057136 (see A057135).
For k = 3, except for 2201^3 = 10662526601, all known palindromic cubes have a palindromic rootnumber (see A002780 and A002781).
For k = 4, all known integers whose fourth power is a palindrome are also palindromes (see A056810 and subsequence A186080).
For k >= 5, G. J. Simmons conjectured there are no palindromes of the form m^k for k >= 5 and m > 1 (see Simmons link p. 98); according to this conjecture, all the terms are of the form (palindrome)^k, with 2 <= k <= 4.

Examples

			First few terms are equal to 1, 2^2, 2^3, 3^2, 11^2, 7^3, 22^2, 11^3, 101^2, 111^2, 11^4 = 121^2, 202^2, 212^2, 1001^2, 101^3, 1111^2, 111^3.
		

Crossrefs

Programs

  • Mathematica
    Block[{n = 10^6, nn, s}, s = Select[Range[2, n], PalindromeQ]; nn = Max[s]^2; {1}~Join~Union@ Reap[Table[Do[If[PalindromeQ[m^k], Sow[m^k]], {k, 2, Log[m, nn]}], {m, s}]][[-1, -1]]] (* Michael De Vlieger, Oct 18 2021 *)
  • PARI
    ispal(x) = my(d=digits(x)); d == Vecrev(d); \\ A002113
    isok(m) = if (m==1, return (1)); my(p); ispal(m) && ispower(m, , &p) && ispal(p); \\ Michel Marcus, Oct 19 2021
    
  • PARI
    ispal(x) = my(d=digits(x)); d == Vecrev(d); \\ A002113
    lista(nn) = {my(list = List(1)); for (k=2, sqrtint(nn), if (ispal(k), my(q = k^2); until (q > nn, if (ispal(q), listput(list, q)); q *= k;););); vecsort(list,,8);} \\ Michel Marcus, Oct 20 2021
  • Python
    # see link for faster version
    def ispal(n): s = str(n); return s == s[::-1]
    def aupto(limit):
        aset, m, mm = {1}, 2, 4
        while mm <= limit:
            if ispal(m):
                mk = mm
                while mk <= limit:
                    if ispal(mk): aset.add(mk)
                    mk *= m
            mm += 2*m + 1
            m += 1
        return sorted(aset)
    print(aupto(10**11)) # Michael S. Branicky, Oct 18 2021
    
Showing 1-8 of 8 results.