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.

A343541 For n > 1, a(n) is the largest base b <= prime(n)-1 such that the digits of prime(n)-1 in base b contain the digit b-1.

Original entry on oeis.org

2, 2, 3, 2, 4, 3, 3, 5, 4, 6, 2, 2, 7, 7, 4, 8, 8, 6, 6, 9, 9, 2, 3, 10, 5, 6, 6, 5, 11, 8, 3, 12, 12, 5, 3, 13, 13, 13, 5, 6, 6, 14, 14, 10, 10, 15, 15, 5, 5, 11, 11, 16, 16, 2, 3, 4, 5, 17, 17, 17, 10, 18, 18, 18, 18, 13, 13, 19, 19, 19
Offset: 2

Views

Author

Devansh Singh, Apr 18 2021

Keywords

Crossrefs

Programs

  • Maple
    f:= proc(n) local p,b,L;
        p:= ithprime(n);
        for b from floor((1 + sqrt(4*p - 3))/2) by -1 do
          L:= convert(p-1,base,b);
          if member(b-1,L) then return b fi
        od;
    end proc:
    map(f, [$2 .. 100]); # Robert Israel, Dec 10 2024
  • Mathematica
    Table[Max@Select[Range[2,Prime@n-1],MemberQ[IntegerDigits[Prime@n-1,#],#-1]&],{n,2,71}] (* Giorgos Kalogeropoulos, Nov 22 2021 *)
  • PARI
    a(n) = my(q=prime(n)-1); forstep(b=q, 2, -1, if (vecmax(digits(q, b)) == b-1, return (b))); \\ Michel Marcus, Apr 19 2021
  • Python
    import sympy
    def a_n(N):
        a_n=[2]
        for i in sympy.primerange(5, N+1):
            a_n.append(A338295(i-1))
        print(a_n)
    def A338295(n):
        checker=0
        for b in range(n//2, 1,-1):
            checker=main_base_check(n, b)
            if checker!=0:
                break
        return checker
    def main_base_check(m, b):
        while m!=0:
            if m%b == b-1:
                return b
            m = m//b
        return 0
    a_n(500)
    

Formula

a(n) <= (1 + sqrt(4*prime(n) - 3))/2 for all n. Prime(n), which is 111 in some base Q, has a(n) = Q+1. Example: 31 = 6*5 + 1 and it is 111 in base 5. - Devansh Singh, Nov 22 2021