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.

A375350 a(n) is the smallest number k such that the sum of the bases b, 1 < b < k-1, for which k is palindromic, equals n . If no such number exists, a(n) = -1.

Original entry on oeis.org

5, 8, 25, 12, 14, 10, 89, 107, 16, 67, 20, 18, 109, 331, 187, 227, 95, 157, 26, 409, 28, 24, 45, 191, 65, 241, 58, 85, 57, 44, 161, 299, 63, 62, 401, 42, 40, 337, 50, 36, 74, 56, 99, 52, 94, 1129, 86, 145, 129, 54, 68, 64, 1613, 76, 48, 1073, 175, 533, 559, 341
Offset: 2

Views

Author

Jean-Marc Rebert, Aug 14 2024

Keywords

Examples

			a(7) = 10, because 10 is palindromic in bases 3 (as 101) and 4 (as 22), which are both less than 9. The sum of these bases (3 + 4) is 7, and no smaller number has this property.
Table begins:
  a(2) = 5 = 101_2,
  a(3) = 8 = 22_3,
  a(4) = 25 = 121_4,
  a(5) = 12 = 22_5,
  a(6) = 14 =  22_6,
  a(7) = 10 = 101_3 = 22_4,
  a(8) = 89 = 131_8,
  a(9) = 107 = 1101011_2 = 212_7,
  a(10) = 16 = 121_3 = 22_7.
		

Crossrefs

Programs

  • Maple
    ispali:= proc(x,b) local F; F:= convert(x,base,b);
      andmap(t -> F[t] = F[-t], [$1.. nops(F)/2])
    end proc:
    f:= proc(k) convert(select(b -> ispali(k,b),[$2..k-2]),`+`) end proc:
    N:= 100: # for a(2) .. a(N)
    V:= Vector(N): count:= 0:
    for x from 5 while count < N-1 do
       v:= f(x);
       if v >= 2 and v <=N and V[v] = 0 then V[v]:= x; count:= count+1;  fi
    od:
    convert(V[2..N],list); # Robert Israel, Oct 14 2024
  • PARI
    isok(k, n) = my(s=0); for(b=2, k-2, my(d=digits(k, b)); if (d == Vecrev(d), s += b)); s == n;
    a(n) = my(k=1); while (!isok(k, n), k++); k; \\ Michel Marcus, Aug 14 2024
    
  • Python
    from itertools import count, islice
    from sympy.ntheory import is_palindromic
    def f(n): return sum(b for b in range(2, n-2) if is_palindromic(n, b))
    def agen(): # generator of terms
        adict, n = dict(), 2
        for k in count(4):
            v = f(k)
            if v not in adict:
                adict[v] = k
                while n in adict: yield adict[n]; n += 1
    print(list(islice(agen(), 60))) # Michael S. Branicky, Oct 15 2024

Formula

A375201(a(n)) = n. - Robert Israel, Oct 15 2024

Extensions

Name clarified by Robert Israel, Oct 15 2024

A087166 Primes which are palindromes in 3 or more bases.

Original entry on oeis.org

17, 31, 67, 73, 107, 109, 127, 151, 157, 173, 181, 191, 197, 211, 227, 241, 257, 271, 277, 307, 313, 337, 353, 373, 379, 401, 409, 419, 421, 433, 443, 457, 461, 463, 487, 521, 523, 541, 577, 587, 601, 617, 619, 631, 647, 661, 673, 683, 701, 719, 727, 743, 757, 761, 773, 787, 797, 809, 857, 859
Offset: 1

Views

Author

Randy L. Ekl, Oct 18 2003

Keywords

Comments

For the purposes of this sequence, single digits are not counted as palindromes (otherwise every number n is a palindrome in all bases > n). - Robert Israel, May 01 2020

Examples

			31 is in the list, as 31 base 2 = 11111, 31 base 5 = 111 and 31 base 30 = 11, i.e. three different ways.
		

Crossrefs

Primes in A253594.

Programs

  • Maple
    N:= 1000: # for all terms <= N
    digrev:= proc(n,b)
      local L,i;
      L:= convert(n,base,b);
      add(L[-i]*b^(i-1),i=1..nops(L))
    end proc:
    bpalis:= proc(b, N)
      local Res,dmax,d,m;
      dmax:= floor(log[b](N))+1;
      if dmax < 2 then return [] fi;
      Res:= seq(i*(b+1),i=1..b-1);
      for d from 3 to dmax do
        if d::even then
          m:= d/2;
          Res:= Res, seq(n*b^m + digrev(n,b),n=b^(m-1)..b^m-1);
        else
          m:= (d-1)/2;
          Res:= Res, seq(seq(n*b^(m+1)+y*b^m+digrev(n,b), y=0..b-1), n=b^(m-1)..b^m-1);
        fi
      od;
      select(`<=`,[Res], N)
    end proc:
    V:= Vector(N):
    for b from 2 to N-1 do
      bp:= bpalis(b,N);
      V[bp]:= V[bp] +~ 1
    od:
    select(p -> isprime(p) and V[p] >= 3, [seq(i,i=3..N,2)]); # Robert Israel, May 01 2020

Extensions

Corrected by Robert Israel, May 01 2020

A375387 a(n) is the least number k whose sum of digits in base 10 is n and that is palindromic in base n, or -1 if no such number exists.

Original entry on oeis.org

-1, 130, 41, 123, 16, 170, -1, 55, 155, 39, 274, 239, 96, 187, 494, 2925, 685, 1784, 1389, 859, 599, 1779, 1978, 989, 6597, 5887, 6968, 8499, 5989, 17969, 29859, 17899, 28898, 435897, 38989, 2089469, 1788960, 498847, 2886278, 487878, 919996, 4098689, 898794, 1896967
Offset: 3

Views

Author

Jean-Marc Rebert, Aug 13 2024

Keywords

Comments

A positive integer that is a multiple of 3 ends with 0 in base 3, so it cannot be a palindrome in base 3.
A positive integer that is a multiple of 9 ends with 0 in base 9, so it cannot be a palindrome in base 9.
From Michael S. Branicky, Aug 15 2024: (Start)
Regarding a(2): To be a palindrome in base 2, it must end with 1, hence odd. To be odd and have digit sum 2 in base 10, it must be of the form t_d = 10^(d-1) + 1, d > 1 (a d-digit base-10 number). t_d is not divisible by 3, and base-2 palindromes with even length (i.e., number of binary digits) are divisible by 3, so, if a(2) exists, it must be a base-2 palindrome with odd length.
Computer search shows no such terms with d <= 10^6, so a(2), if it exists, has > 10^6 decimal digits. (End)

Examples

			a(5) = 41, because 4 + 1 = 5 and 41 = 131_5, and no lesser number has this property.
First terms are:
  130 = 2002_4
  41  = 131_5
  123 = 3323_6
  16  = 22_7
  170 = 252_8
		

Crossrefs

Programs

  • PARI
    isok(k, n) = if (sumdigits(k)==n, my(d=digits(k, n)); d==Vecrev(d));
    a(n) = if ((n==3) || (n==9), return((-1))); my(k=1); while (!isok(k,n), k++); k; \\ Michel Marcus, Aug 13 2024
    
  • Python
    # see Links for faster variants
    from itertools import count
    from sympy.ntheory import is_palindromic
    def a(n):
        if n in {3, 9}: return -1
        return next(k for k in count(10**(n//9)-1) if sum(map(int, str(k)))==n and is_palindromic(k, n))
    print([a(n) for n in range(3, 47)]) # Michael S. Branicky, Aug 13 2024

A374561 Integers which are palindromes when expressed in more than one base 2 to 10.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 16, 17, 18, 20, 21, 24, 26, 27, 28, 31, 33, 36, 40, 45, 46, 50, 51, 52, 55, 57, 63, 65, 67, 73, 78, 80, 82, 85, 88, 91, 92, 93, 98, 99, 100, 104, 105, 107, 109, 111, 114, 119, 121, 127, 129, 130, 135, 141, 142, 150, 151, 154, 160, 164, 170, 171, 173, 178
Offset: 1

Views

Author

Paul Duckett, Jul 11 2024

Keywords

Comments

Sequence is infinite because all integers of the form 4^n-1 are palindromic in bases 2 and 4.

Examples

			5 is a term since it's palindromic in more than one base: base 2 (101) and base 4 (11).
121 is a term since it's palindromic in base 3 (11111) and base 7 (232), and also in fact in bases 8 and 10.
		

Crossrefs

Programs

Formula

A050812(a(n)) >= 2. - Michael S. Branicky, Aug 02 2024
Showing 1-4 of 4 results.