OFFSET
1,2
COMMENTS
Cooper and Kennedy proved that there are infinitely many runs of 20 consecutive Niven numbers. Therefore this sequence is infinite. - Amiram Eldar, Jan 03 2020
REFERENCES
Jean-Marie De Koninck, Those Fascinating Numbers, American Mathematical Society, 2009, p. 36, entry 110.
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
Curtis Cooper and Robert E. Kennedy, On consecutive Niven numbers, Fibonacci Quarterly, Vol. 21, No. 2 (1993), pp. 146-151.
Helen G. Grundman, Sequences of consecutive Niven numbers, Fibonacci Quarterly, Vol. 32, No. 2 (1994), pp. 174-175.
Eric Weisstein's World of Mathematics, Harshad Number.
Wikipedia, Harshad number.
Brad Wilson Construction of 2n consecutive n-Niven numbers, Fibonacci Quarterly, Vol. 35, No. 2 (1997), pp. 122-128.
FORMULA
EXAMPLE
510 is in the sequence because 510, 511, 512 and 513 are all Niven numbers.
MATHEMATICA
nivenQ[n_] := Divisible[n, Total @ IntegerDigits[n]]; niv = nivenQ /@ Range[4]; seq = {}; Do[niv = Join[Rest[niv], {nivenQ[k]}]; If[And @@ niv, AppendTo[seq, k - 3]], {k, 4, 5*10^5}]; seq (* Amiram Eldar, Jan 03 2020 *)
PROG
(Magma) f:=func<n|n mod &+Intseq(n) eq 0>; a:=[]; for k in [1..500000] do if forall{m:m in [0..3]|f(k+m)} then Append(~a, k); end if; end for; a; // Marius A. Burtea, Jan 03 2020
(PARI) {A141769_first( N=50, L=4, a=List())= for(n=1, oo, n+=L; for(m=1, L, n--%sumdigits(n) && next(2)); listput(a, n); N--|| break); a} \\ M. F. Hasler, Jan 03 2022
(Python)
from itertools import count, islice
def agen(): # generator of terms
h1, h2, h3, h4 = 1, 2, 3, 4
while True:
if h4 - h1 == 3: yield h1
h1, h2, h3, h4, = h2, h3, h4, next(k for k in count(h4+1) if k%sum(map(int, str(k))) == 0)
print(list(islice(agen(), 40))) # Michael S. Branicky, Mar 17 2024
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Sergio Pimentel, Sep 15 2008
EXTENSIONS
More terms from Amiram Eldar, Jan 03 2020
STATUS
approved