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.

A330812 Least number >= n that is a Niven number in all bases 1 <= b <= n.

This page as a plain text file.
%I A330812 #8 Jan 03 2020 10:32:29
%S A330812 1,2,4,4,6,6,12,24,24,24,24,24,24,432,720,720,720,720,720,840,840,840,
%T A330812 3360,13860,13860,13860,13860,13860,40320,100800,100800,2106720,
%U A330812 7698600,9028800,9028800,9028800,9028800,9028800,9028800,9028800,9028800,9028800,9028800
%N A330812 Least number >= n that is a Niven number in all bases 1 <= b <= n.
%e A330812 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.
%p A330812 A[1]:= 1: m:= 1:
%p A330812 for n from 2 while m < 30 do
%p A330812    kk:= n;
%p A330812    for k from 2 to n-1 do
%p A330812      if n mod convert(convert(n,base,k),`+`) <> 0 then kk:= k-1; break fi;
%p A330812      od;
%p A330812    if kk > m then
%p A330812      for k from m+1 to kk do A[k]:= n od;
%p A330812      m:= kk;
%p A330812    fi
%p A330812 od:
%p A330812 seq(A[k],k=1..m); # _Robert Israel_, Jan 01 2020
%t A330812 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]
%Y A330812 Cf. A005349, A049445, A080221, A226169.
%K A330812 nonn,base
%O A330812 1,2
%A A330812 _Amiram Eldar_, Jan 01 2020