login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A330812
Least number >= n that is a Niven number in all bases 1 <= b <= n.
0
1, 2, 4, 4, 6, 6, 12, 24, 24, 24, 24, 24, 24, 432, 720, 720, 720, 720, 720, 840, 840, 840, 3360, 13860, 13860, 13860, 13860, 13860, 40320, 100800, 100800, 2106720, 7698600, 9028800, 9028800, 9028800, 9028800, 9028800, 9028800, 9028800, 9028800, 9028800, 9028800
OFFSET
1,2
EXAMPLE
a(4) = 4 since the representations of 4 in bases 1 to 4 are 1111, 100, 11, 10, the corresponding sums of digits are 4, 1, 2, and 1, and all are divisors of 4. Thus 4 is a Niven number in bases 1, 2, 3, and 4, and it is the least number with this property.
MAPLE
A[1]:= 1: m:= 1:
for n from 2 while m < 30 do
kk:= n;
for k from 2 to n-1 do
if n mod convert(convert(n, base, k), `+`) <> 0 then kk:= k-1; break fi;
od;
if kk > m then
for k from m+1 to kk do A[k]:= n od;
m:= kk;
fi
od:
seq(A[k], k=1..m); # Robert Israel, Jan 01 2020
MATHEMATICA
nivenQ[n_, b_] := Divisible[n, Total @ IntegerDigits[n, b]]; a[n_] := Module[{k = n}, While[!AllTrue[Range[2, n], nivenQ[k, #] &], k++]; k]; Array[a, 30]
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Amiram Eldar, Jan 01 2020
STATUS
approved