OFFSET
3,1
LINKS
Mital Ashok, Table of n, a(n) for n = 3..10000
EXAMPLE
For n = 7, a(7) = 2 because 7 is 111_2 in base 2.
MAPLE
f:= proc(n) local b, t;
for b from 2 to floor(sqrt(n)) do
t:= n*(b-1)+1;
if t = b^padic:-ordp(t, b) then return b fi
od;
n-1
end proc:
map(f, [$3..100]); # Robert Israel, May 17 2026
MATHEMATICA
a[n_]:=Module[{b=1}, Until[ContainsOnly[IntegerDigits[n, b], {1}], b++]; b]; Array[a, 74, 3] (* James C. McMahon, May 17 2026 *)
PROG
(Python)
def a(n):
for b in range(2, n):
x = (b-1)*n+1
while x%b == 0:
x //= b
if x == 1:
return b
(Python)
from itertools import count
from sympy import integer_log
def A395985(n): return next(filter(lambda b: integer_log(n*(b-1)+1, b)[1], count(2))) # Chai Wah Wu, May 17 2026
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Mital Ashok, May 13 2026
STATUS
approved
