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.

A135549 Number of bases b, 1 < b < n-1, in which n is a palindrome.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 2, 2, 2, 0, 2, 3, 1, 1, 3, 1, 3, 2, 3, 1, 2, 2, 2, 2, 2, 1, 4, 1, 2, 1, 4, 1, 3, 1, 2, 3, 3, 0, 4, 1, 3, 3, 4, 0, 3, 3, 3, 3, 1, 1, 5, 1, 2, 4, 3, 4, 3, 2, 3, 1, 3, 1, 5, 2, 2, 2, 2, 1, 5, 0, 6, 2, 3, 1, 5, 4, 2, 1, 4, 1, 4, 3, 4, 3, 1, 1, 5, 1, 4, 3, 6, 1, 3, 0, 5
Offset: 0

Views

Author

John P. Linderman, Feb 26 2008, Feb 28 2008

Keywords

Comments

Every integer n is a palindrome when expressed in unary, or in base n-1 (where it will be 11). So here we assume 1 < b < n-1.
Records for a(n)>=1 are in A107129. - Dmitry Kamenetsky, Oct 22 2015

Crossrefs

Cf. A016038 (non-palindromic numbers in any base 1 < b < n-1)

Programs

  • Mathematica
    a = {0, 0, 0}; For[n = 4, n < 100, n++, c = 0; For[b = 2, b < n - 1, b++, If[IntegerDigits[n, b] == Reverse[IntegerDigits[n, b]], c++ ]]; AppendTo[a, c]]; a (* Stefan Steinerberger, Feb 27 2008 *)
    Table[cnt=0; Do[d=IntegerDigits[n,b]; If[d==Reverse[d], cnt++ ], {b,2,n-2}]; cnt, {n,0,100}] (* T. D. Noe, Feb 28 2008 *)
    Table[Total[Boole[Table[PalindromeQ[IntegerDigits[n,b]],{b,2,n-2}]]],{n,0,120}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Apr 14 2020 *)

Formula

a(n) = A065531(n)-1 = A126071(n)-2 for n>2. - T. D. Noe, Feb 28 2008

A135551 Number of bases b, 1 < b < n, in which n is a palindrome.

Original entry on oeis.org

0, 0, 0, 1, 1, 2, 1, 2, 2, 2, 3, 1, 2, 2, 2, 3, 3, 3, 3, 1, 3, 4, 2, 2, 4, 2, 4, 3, 4, 2, 3, 3, 3, 3, 3, 2, 5, 2, 3, 2, 5, 2, 4, 2, 3, 4, 4, 1, 5, 2, 4, 4, 5, 1, 4, 4, 4, 4, 2, 2, 6, 2, 3, 5, 4, 5, 4, 3, 4, 2, 4, 2, 6, 3, 3, 3, 3, 2, 6, 1, 7, 3, 4, 2, 6, 5, 3, 2, 5, 2, 5, 4, 5, 4, 2, 2, 6, 2, 5, 4, 7, 2, 4, 1, 6
Offset: 0

Views

Author

John P. Linderman, Feb 26 2008, Feb 28 2008

Keywords

Comments

Every integer n is a palindrome when expressed in unary, or in base n-1 (where it will be 11).
First occurrence in A037183.
a(n) is always less than A001221(n) except for 2 and 6; a(n) is always less than A001222(n) except for even powers of twos and 6, 12, 81, 243, 625, 729, 2187, 19683, 59049, ..., . - Robert G. Wilson v, Jul 17 2016

Crossrefs

Essentially the same as A065531.

Programs

  • Mathematica
    palindromicBases[n_] := Module[{p}, Table[p = IntegerDigits[n, b]; If[p == Reverse[p], {b, p}, Sequence @@ {}], {b, 2, n - 1}]]; Array[ Length@ palindromicBases@# &, 105, 0] (* Robert G. Wilson v, Oct 15 2014 *)
    palQ[n_Integer, base_Integer] := Module[{idn = IntegerDigits[n, base]}, idn == Reverse[idn]];
    f[n_] := Block[{s = Ceiling@ Sqrt@ n, b = 2, c = If[ IntegerQ@ Sqrt[4n + 1], -1, 0]}, While[b < s, If[ palQ[n, b], c++]; b++]; c + Count[ Mod[n, Range[s - 1]], 0]]; f[0] = 0; Array[f, 105, 0] (* much faster for large Ns *) (* Robert G. Wilson v, Oct 20 2014 *)

Formula

a(n) = A135549(n) + 1 for n>2; otherwise a(n) = A135549(n) = 0. - Michel Marcus, Oct 15 2014
a(n) = A126071(n) - 1. - Michel Marcus, Mar 07 2015

A137779 Number of bases (numbering systems, including unary) in which the n-th prime is a palindrome having at least two digits.

Original entry on oeis.org

1, 2, 3, 3, 2, 3, 4, 2, 3, 3, 4, 3, 3, 3, 2, 2, 3, 3, 4, 3, 4, 2, 3, 3, 3, 3, 2, 4, 4, 3, 4, 3, 2, 2, 2, 4, 4, 2, 2, 4, 2, 4, 5, 3, 4, 3, 4, 2, 4, 3, 3, 3, 4, 3, 6, 2, 2, 4, 4, 3, 2, 2, 4, 2, 5, 2, 3, 5, 2, 3, 5, 2, 2, 6, 5, 3, 2, 3, 4, 4, 4, 5, 3, 4, 2, 5, 3, 4, 4, 4, 3, 3, 4, 2, 3, 3, 3, 4, 4
Offset: 1

Views

Author

Attila Olah (jolafix(AT)gmail.com), May 06 2008, corrected May 08 2008

Keywords

Comments

Each prime p > 2 is palindrome in at least base 1 and base p-1, since p = 1*(p-1)^1 + 1*(p-1)^0 and p = 1*1^(p-1) + 1*1(p-2) + ... + 1*1^1 + 1*1^0.

Examples

			a(621) = 9 because the 621st prime (4591) is a palindrome in 9 bases: base 1, 19, 20, 24, 33, 37, 51, 54 and 4590 (4591 = 1*4590^1 + 1*4590^0).
		

Crossrefs

Programs

  • PARI
    ispal(v) = {for(i=1, #v\2, if (v[i] != v[#v-i+1], return(0));); return(1);};
    a(n) = {p = prime(n); 1 + sum(i=2, p, ispal(digits(p, i)));} \\ Michel Marcus, Sep 04 2013

Formula

a(n) = A126071(prime(n)). - Charles R Greathouse IV, Jun 19 2014

A384436 a(n) is the number of distinct ways to represent n in any integer base >= 2 using only square digits.

Original entry on oeis.org

1, 1, 1, 2, 4, 3, 3, 3, 3, 6, 5, 4, 5, 5, 4, 4, 6, 5, 4, 5, 7, 7, 5, 5, 7, 8, 6, 6, 8, 7, 7, 7, 7, 7, 7, 6, 11, 9, 6, 7, 10, 7, 7, 7, 8, 8, 8, 6, 8, 11, 7, 7, 9, 10, 7, 7, 10, 10, 7, 7, 11, 10, 7, 7, 13, 11, 7, 7, 11, 10, 7, 7, 10, 11, 8, 8, 11, 11, 9, 8, 11, 15
Offset: 0

Views

Author

Felix Huber, May 29 2025

Keywords

Comments

The representations of n remain the same for bases greater than n, as they all consist solely of the digit n.

Examples

			The a(36) = 11 distinct ways to represent 36 using only square digits are [1,0,0,1,0,0] in base 2, [1,1,0,0] in base 3, [1,0,0] in base 6, [4,4] in base 8, [4,0] in base 9, [1,16] in base 20, [1,9] in base 27, [1,4] in base 32, [1,1] in base 35, [1,0] in base 36 and [36] in bases >= 37.
		

Crossrefs

Programs

  • Maple
    A384436:=proc(n)
        local a,b,c;
        a:=0;
        for b from 2 to n+1 do
            c:=convert(n,'base',b);
            if select(issqr,c)=c then
                a:=a+1
            fi
        od;
        return max(1,a)
    end proc;
    seq(A384436(n),n=0..81);
  • Mathematica
    a[n_] := Sum[Boole[AllTrue[IntegerDigits[n, b], IntegerQ[Sqrt[#]] &]], {b, 2, n+1}]; a[0] = 1; Array[a, 100, 0] (* Amiram Eldar, May 29 2025 *)
  • PARI
    a(n) = sum(b=2, n+1, my(d=digits(n,b)); #select(issquare, d) == #d); \\ Michel Marcus, May 29 2025

Formula

Trivial lower bound for n >= 2: a(n) >= 2 for nonsquares n and a(n) >= 3 for squares n because in base 2 the representations of n consists only of the square digits '0' and '1', in base n the representation of n is [1,0] and in bases > n the representation of n is [n].
Showing 1-4 of 4 results.