A055241 Smallest base in which n is not divisible by any of its digits (0 if no such base).
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 5, 0, 0, 0, 5, 0, 5, 0, 8, 6, 5, 0, 7, 7, 10, 0, 6, 0, 7, 9, 7, 6, 4, 0, 7, 7, 7, 11, 7, 0, 4, 12, 16, 7, 4, 0, 9, 11, 9, 9, 5, 10, 8, 10, 10, 9, 4, 0, 8, 8, 11, 11, 5, 14, 5, 9, 9, 11, 9, 13, 5, 10, 11, 10, 5, 10, 5, 11, 11, 11, 10, 15, 5, 10, 10, 13, 5, 19
Offset: 1
Examples
a(11)=4 because it is written as 111111111111 in base 1, 1011 in base 2, 102 in base 3 and 23 in base 4; 11 is divisible by 1 but not by 2 or 3
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
f:= proc(n) local b,L; for b from 3 to n-2 do L:= convert(convert(n,base,b),set) minus {0}; if andmap(d -> n mod d <> 0, L) then return b fi od; 0 end proc: map(f, [$1..100]); # Robert Israel, Oct 29 2024
-
Python
from sympy.ntheory import digits def a(n): return next((b for b in range(3, n-2) if not any(n%d==0 for d in digits(n, b)[1:] if d > 0)), 0) print([a(n) for n in range(1, 91)]) # Michael S. Branicky, Oct 29 2024