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

A126071 Number of bases (2 <= b <= n+1) in which n is a palindrome.

Original entry on oeis.org

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

Views

Author

Paul Richards, Mar 01 2007

Keywords

Comments

a(n) >= 1, since n will always have a single "digit" in base n+1.

Examples

			From bases 2 to 9 respectively, 8 can be represented as: 1000, 22, 20, 13, 12, 11, 10, 8. Three of those are symmetrical (22, 11, 8) and so a(8) = 3.
		

Crossrefs

Cf. A016026.
Cf. A016038, A047811 (related to numbers having 2 bases).

Programs

Extensions

Extended by T. D. Noe, Oct 04 2012

A249634 Least number k that is a palindrome in base n but no bases less than n, or 0 if no such k exists.

Original entry on oeis.org

0, 1, 2, 25, 6, 14, 32, 54, 30, 11, 84, 39, 140, 75, 176, 102, 198, 19, 220, 147, 110, 69, 384, 175, 416, 486, 420, 58, 570, 279, 544, 429, 306, 245, 684, 296, 380, 663, 880, 615, 1134, 258, 1012, 1035, 1104, 47, 1392, 539, 1500, 1071, 1508, 53, 2106, 935, 1736, 1311, 1798, 413, 2940, 671
Offset: 1

Views

Author

Robert G. Wilson v, Nov 02 2014

Keywords

Comments

This sequence gives the first occurrence of n in A016026.
"Of course, every positive integer has a palindromic representation in SOME base. If we let f(n) denote the smallest base relative to which n is palindromic, then clearly f(n) is no greater than n-1, because every number n has the palindromic form '11' in the base (n-1)." [See Math Pages link; f(n)=A016026(n).]

Examples

			a(6) = 14 because 14_10 equals 22_6. And 14 is the least integer whose representation in base 6 yields a palindrome as its first palindrome. 7, though palindromic in base 6, is also palindromic in a base less than 6 (7_10 = 111_2 = 11_6) so 7 cannot be a(6).
		

Crossrefs

Cf. A016026.

Programs

  • Maple
    N:= 100: # to get a(1) to a(N)
    ispali:= proc(k,b) local L; L:= convert(k,base,b); L = ListTools:-Reverse(L); end proc:
    Needed:= N-1:
    for k from 1 while Needed > 0 do
       for b from 2 to N while not ispali(k,b) do od:
       if b <= N and not assigned(A[b]) then A[b]:= k; Needed:= Needed - 1 fi
    od:
    0, seq(A[n],n=1..N); # Robert Israel, Nov 04 2014
  • Mathematica
    f[n_] := Block[{b = 2}, While[ Reverse[idn = IntegerDigits[n, b]] != idn, b++]; b]; a = Array[f, 3000]; Table[ Position[a, n, 1, 1], {n, 2, 60}] // Flatten
  • PARI
    a(n)=m=1;while(m,c=0;for(k=2,n-1,D=digits(m,k);if(D==Vecrev(D),c++;break));if(!c&&(d=digits(m,n))==Vecrev(d),return(m));m++)
    print1(0,", ");for(n=2,100,print1(a(n),", ")) \\ Derek Orr, Nov 02 2014

A086757 Smallest prime p such that n is a palindrome in base-p representation.

Original entry on oeis.org

2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 13, 5, 3, 13, 2, 3, 2, 5, 23, 3, 2, 23, 3, 5, 29, 3, 2, 3, 31, 29, 2, 7, 2, 37, 37, 5, 41, 37, 41, 3, 5, 13, 47, 43, 2, 5, 53, 7, 53, 7, 2, 3, 59, 17, 59, 3, 5, 59, 61, 11, 67, 5, 2, 7, 2, 67, 5, 3, 71, 13, 7, 5, 2, 73, 79, 37, 79, 5, 83, 3, 83, 3, 5, 11, 2
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 01 2003

Keywords

Comments

A016026(n) <= a(n) <= A007918(n).

Crossrefs

Cf. A006995 (a(n)=2).

Programs

  • PARI
    isok(p,n) = my(d=digits(n,p)); d == Vecrev(d);
    a(n) = my(p=2); while (!isok(p,n), p=nextprime(p+1)); p; \\ Michel Marcus, Jan 30 2024
  • Python
    from sympy import sieve
    from sympy.ntheory import is_palindromic
    def a086757(n): return next(p for p in sieve if is_palindromic(n, p)) # Dumitru Damian, Jan 29 2024
    

A065437 Smallest base relative to which the n-th prime is palindromic.

Original entry on oeis.org

3, 2, 2, 2, 10, 3, 2, 18, 3, 4, 2, 6, 5, 6, 46, 52, 4, 6, 5, 7, 2, 78, 5, 8, 8, 10, 102, 2, 5, 8, 2, 10, 136, 138, 148, 3, 7, 162, 166, 3, 178, 10, 6, 12, 6, 11, 8, 222, 8, 12, 3, 14, 12, 8, 2, 262, 268, 7, 11, 14, 282, 292, 7, 310, 2, 316, 15, 9, 346, 8, 10, 358, 366, 4, 13, 10, 388
Offset: 1

Views

Author

Peter Bertok (peter(AT)bertok.com), Nov 23 2001

Keywords

Comments

Subset of A016026 for primes only.

Examples

			71 is the 20th prime and can be written as 131 in base 7, hence a(20)=7.
		

Crossrefs

Cf. A016026.

Programs

  • Mathematica
    PrimeMinBase[ n_ ] := NestWhile[ # + 1 &, 2, IntegerDigits[ Prime[ n ], # ] != Reverse[ IntegerDigits[ Prime[ n ], # ] ] & ]
    sbr[n_]:=Module[{k=2},While[IntegerDigits[n,k]!=Reverse[ IntegerDigits[ n,k]], k++]; k]; Table[sbr[n],{n,Prime[Range[80]]}] (* Harvey P. Dale, Jun 07 2016 *)

A065809 a(n) is the smallest number m > n such that m is palindromic in base n and is not palindromic in bases b with 2 <= b < n.

Original entry on oeis.org

3, 4, 25, 6, 14, 32, 54, 30, 11, 84, 39, 140, 75, 176, 102, 198, 19, 220, 147, 110, 69, 384, 175, 416, 486, 420, 58, 570, 279, 544, 429, 306, 245, 684, 296, 380, 663, 880, 615, 1134, 258, 1012, 1035, 1104, 47, 1392, 539, 1500, 1071, 1508, 53, 2106
Offset: 2

Views

Author

Naohiro Nomoto, Dec 06 2001

Keywords

Comments

Index at which first occurrence of n occurs in A016026 when the palindrome is multidigit. Only the first two terms of A016026 are single-digit palindromes. - Robert G. Wilson v, Dec 22 2021

Examples

			From _Robert G. Wilson v_, Dec 22 2021: (Start)
a(2) = 3 since A016026(3) = 2;
a(3) = 4 since A016026(4) = 3;
a(4) = 25 since A016026(25) = 4; etc. (End)
		

Crossrefs

Programs

Extensions

Definition edited by N. J. A. Sloane, Apr 08 2019

A369233 Smallest base for which the digits expansion of 2^n is palindromic.

Original entry on oeis.org

3, 3, 3, 3, 7, 7, 7, 15, 7, 7, 31, 7, 15, 15, 31, 15, 15, 31, 63, 15, 31, 31, 127, 63, 31, 31, 63, 127, 127, 31, 63, 63, 255, 255, 127, 63, 63, 127, 511, 255, 255, 63, 127, 127, 511, 511, 511, 255, 127, 127, 255, 1023, 1023, 511, 511, 127, 255, 255, 2047, 1023, 1023, 1023, 127, 255
Offset: 1

Views

Author

Michel Marcus, Jan 17 2024

Keywords

Comments

From the Kreher and Stinson article we know that a(n) is of the form 2^k-1 (cf. A000225). - David A. Corneth, Jan 18 2024

Crossrefs

Programs

  • Maple
    f:= proc(n) local x,b,L,i;
      x:= 2^n;
      for b from 3 do
        L:= convert(x,base,b);
        if andmap(i -> L[i]=L[-i], [$1..nops(L)/2]) then return b fi
      od
    end proc:
    map(f,[$1..100]); # Robert Israel, Jan 17 2024
  • Mathematica
    A369233[n_] := Block[{p = 2^n, k = 1}, While[!PalindromeQ[IntegerDigits[p, 2^++k-1]]]; 2^k-1]; Array[A369233, 100] (* Paolo Xausa, Mar 10 2024 *)
  • PARI
    ispal(n, b) = my(d=digits(n, b)); d == Vecrev(d);
    a(n) = my(b=2, N=2^n); while (! ispal(N, b), b++); b;
    
  • PARI
    a(n) = {my(pow2 = 1<David A. Corneth, Jan 18 2024
    
  • Python
    from itertools import count
    from sympy.ntheory.factor_ import digits
    def A369233(n):
        m = 1<>1)]==s[:-t-1:-1]) # Chai Wah Wu, Jan 17 2024

Formula

a(n) = A016026(A000079(n)).

A372754 a(n) is the least base in which the Fibonacci number A000045(n) is a palindrome.

Original entry on oeis.org

2, 2, 3, 2, 2, 3, 3, 2, 4, 4, 8, 11, 3, 11, 9, 11, 15, 29, 25, 29, 29, 29, 40, 17, 121, 76, 76, 69, 147, 39, 148, 199, 199, 199, 311, 361, 10876, 428, 521, 521, 1026, 1364, 1025, 1364, 1364, 1364, 2100, 2018, 4973, 3571, 3571, 3571, 5802, 6461, 11343, 9349, 9349, 9349, 31952, 24476, 15885, 24476
Offset: 1

Views

Author

Robert Israel, May 12 2024

Keywords

Comments

With F = A000045 the Fibonacci numbers and L = A000032 the Lucas numbers, for j odd we have F(3*j+k) = F(j+k)*L(j)^2 + F(k)*L(j) + F(j+k), thus this is a palindrome mod L(j) if F(k) >= 0 and 0 <= F(j+k) < L(j). Therefore a(6*n), a(6*n+2), a(6*n+3) and a(6*n+4) all <= L(2*n+1).

Examples

			A000045(6) = 8.  In base 2 this is 1000, not a palindrome, but in base 3 it is 22, a palindrome.  Thus a(6) = 3.
		

Crossrefs

Programs

  • Maple
    f:= proc(x) local b,L;
      for b from 2 do
        L:= convert(x,base,b);
        if L = ListTools:-Reverse(L) then return b fi
      od
    end proc:
    map(f, [seq(combinat:-fibonacci(n), n=1..70)]);
  • Mathematica
    A372754[n_] := Block[{b = 1}, While[!PalindromeQ[IntegerDigits[#, ++b]]] & [Fibonacci[n]]; b]; Array[A372754, 70] (* Paolo Xausa, May 18 2024 *)
  • Python
    from itertools import count
    from sympy import fibonacci
    from sympy.ntheory.factor_ import digits
    def A372754(n): return next(b for b in count(2) if (s := digits(fibonacci(n),b)[1:])[:(t:=len(s)+1>>1)]==s[:-t-1:-1]) # Chai Wah Wu, May 13 2024

Formula

a(n) = A016026(A000045(n)).
Showing 1-7 of 7 results.