login
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.
0
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,1
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
MATHEMATICA
Table[Max@Select[Range[2, Prime@n-1], MemberQ[IntegerDigits[Prime@n-1, #], #-1]&], {n, 2, 71}] (* Giorgos Kalogeropoulos, Nov 22 2021 *)
PROG
(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)
(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
CROSSREFS
Sequence in context: A066241 A334857 A331614 * A060025 A368572 A067399
KEYWORD
nonn,base
AUTHOR
Devansh Singh, Apr 18 2021
STATUS
approved