login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A154701 Numbers k such that k, k + 1 and k + 2 are 3 consecutive Harshad numbers. 33
1, 2, 3, 4, 5, 6, 7, 8, 110, 510, 511, 1010, 1014, 1015, 2022, 2023, 2464, 3030, 3031, 4912, 5054, 5831, 7360, 8203, 9854, 10010, 10094, 10307, 10308, 11645, 12102, 12103, 12255, 12256, 13110, 13111, 13116, 13880, 14704, 15134, 17152, 17575, 18238, 19600, 19682 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Harshad numbers are also known as Niven numbers.
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
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.
Wikipedia, Harshad number
Brad Wilson, Construction of 2n consecutive n-Niven numbers, Fibonacci Quarterly, Vol. 35, No. 2 (1997), pp. 122-128.
EXAMPLE
110 is a term since 110 is divisible by 1 + 1 + 0 = 2, 111 is divisible by 1 + 1 + 1 = 3, and 112 is divisible by 1 + 1 + 2 = 4.
MAPLE
Res:= NULL: count:= 0:
state:= 1:
L:= [1]:
for n from 2 while count < 100 do
L[1]:=L[1]+1;
for k from 1 while L[k]=10 do L[k]:= 0;
if k = nops(L) then L:= [0$nops(L), 1]; break
else L[k+1]:= L[k+1]+1 fi
od:
s:= convert(L, `+`);
if n mod s = 0 then
state:= min(state+1, 3);
if state = 3 then count:= count+1; Res:= Res, n-2; fi
else state:= 0
fi
od:
Res; # Robert Israel, Feb 01 2019
MATHEMATICA
nivenQ[n_] := Divisible[n, Total @ IntegerDigits[n]]; niv = nivenQ /@ Range[3]; seq = {}; Do[niv = Join[Rest[niv], {nivenQ[k]}]; If[And @@ niv, AppendTo[seq, k - 2]], {k, 3, 2*10^4}]; seq (* Amiram Eldar, Jan 03 2020 *)
PROG
(C) #include <stdio.h>
#include <conio.h>
int is_harshad(int n){
int i, j, count=0;
i=n;
while(i>0){
count=count+i%10;
i=i/10;
}
return n%count==0?1:0;
}
main(){
int k;
clrscr();
for(k=1; k<=30000; k++)
if(is_harshad(k)&&is_harshad(k+1)&&is_harshad(k+2))
printf("%d, ", k);
getch();
return 0;
}
(Magma) f:=func<n|n mod &+Intseq(n) eq 0>; a:=[]; for k in [1..20000] do if forall{m:m in [0..2]|f(k+m)} then Append(~a, k); end if; end for; a; // Marius A. Burtea, Jan 03 2020
(Python)
from itertools import count, islice
def agen(): # generator of terms
h1, h2, h3 = 1, 2, 3
while True:
if h3 - h1 == 2: yield h1
h1, h2, h3 = h2, h3, next(k for k in count(h3+1) if k%sum(map(int, str(k))) == 0)
print(list(islice(agen(), 45))) # Michael S. Branicky, Mar 17 2024
CROSSREFS
A subset of A005349.
Sequence in context: A290148 A171717 A303369 * A004870 A037336 A037443
KEYWORD
nonn,base
AUTHOR
Avik Roy (avik_3.1416(AT)yahoo.co.in), Jan 14 2009, Jan 15 2009
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 17:10 EDT 2024. Contains 371962 sequences. (Running on oeis4.)