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.

Showing 1-10 of 26 results. Next

A005349 Niven (or Harshad, or harshad) numbers: numbers that are divisible by the sum of their digits.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 21, 24, 27, 30, 36, 40, 42, 45, 48, 50, 54, 60, 63, 70, 72, 80, 81, 84, 90, 100, 102, 108, 110, 111, 112, 114, 117, 120, 126, 132, 133, 135, 140, 144, 150, 152, 153, 156, 162, 171, 180, 190, 192, 195, 198, 200, 201, 204
Offset: 1

Views

Author

Keywords

Comments

Both spellings, "Harshad" or "harshad", are in use. It is a Sanskrit word, and in Sanskrit there is no distinction between upper- and lower-case letters. - N. J. A. Sloane, Jan 04 2022
z-Niven numbers are numbers n which are divisible by (A*s(n) + B) where A, B are integers and s(n) is sum of digits of n. Niven numbers have A = 1, B = 0. - Ctibor O. Zizka, Feb 23 2008
A070635(a(n)) = 0. A038186 is a subsequence. - Reinhard Zumkeller, Mar 10 2008
A049445 is a subsequence of this sequence. - Ctibor O. Zizka, Sep 06 2010
Complement of A065877; A188641(a(n)) = 1; A070635(a(n)) = 0. - Reinhard Zumkeller, Apr 07 2011
A001101, the Moran numbers, are a subsequence. - Reinhard Zumkeller, Jun 16 2011
A140866 gives the number of terms <= 10^k. - Robert G. Wilson v, Oct 16 2012
The asymptotic density of this sequence is 0 (Cooper and Kennedy, 1984). - Amiram Eldar, Jul 10 2020
From Amiram Eldar, Oct 02 2023: (Start)
Named "Harshad numbers" by the Indian recreational mathematician Dattatreya Ramchandra Kaprekar (1905-1986) in 1955. The meaning of the word is "giving joy" in Sanskrit.
Named "Niven numbers" by Kennedy et al. (1980) after the Canadian-American mathematician Ivan Morton Niven (1915-1999). During a lecture given at the 5th Annual Miami University Conference on Number Theory in 1977, Niven mentioned a question of finding a number that equals twice the sum of its digits, which appeared in the children's pages of a newspaper. (End)

Examples

			195 is a term of the sequence because it is divisible by 15 (= 1 + 9 + 5).
		

References

  • Paul Dahlenberg and T. Edgar, Consecutive factorial base Niven numbers, Fib. Q., 56:2 (2018), 163-166.
  • D. R. Kaprekar, Multidigital Numbers, Scripta Math., Vol. 21 (1955), p. 27.
  • Robert E. Kennedy and Curtis N. Cooper, On the natural density of the Niven numbers, Abstract 816-11-219, Abstracts Amer. Math. Soc., 6 (1985), 17.
  • Robert E. Kennedy, Terry A. Goodman, and Clarence H. Best, Mathematical Discovery and Niven Numbers, The MATYC Journal, Vol. 14, No. 1 (1980), pp. 21-25.
  • József Sándor and Borislav Crstici, Handbook of Number theory II, Kluwer Academic Publishers, 2004, Chapter 4, p. 381.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, 171.

Crossrefs

Cf. A001102 (a subsequence).
Cf. A118363 (for factorial-base analog).
Cf. A330927, A154701, A141769, A330928, A330929, A330930 (start of runs of 2, 3, ..., 7 consecutive Niven numbers).

Programs

  • GAP
    Filtered([1..230],n-> n mod List(List([1..n],ListOfDigits),Sum)[n]=0); # Muniru A Asiru
  • Haskell
    a005349 n = a005349_list !! (n-1)
    a005349_list = filter ((== 0) . a070635) [1..]
    -- Reinhard Zumkeller, Aug 17 2011, Apr 07 2011
    
  • Magma
    [n: n in [1..250] | n mod &+Intseq(n) eq 0];  // Bruno Berselli, May 28 2011
    
  • Magma
    [n: n in [1..250] | IsIntegral(n/&+Intseq(n))];  // Bruno Berselli, Feb 09 2016
    
  • Maple
    s:=proc(n) local N:N:=convert(n,base,10):sum(N[j],j=1..nops(N)) end:p:=proc(n) if floor(n/s(n))=n/s(n) then n else fi end: seq(p(n),n=1..210); # Emeric Deutsch
  • Mathematica
    harshadQ[n_] := Mod[n, Plus @@ IntegerDigits@ n] == 0; Select[ Range[1000], harshadQ] (* Alonso del Arte, Aug 04 2004 and modified by Robert G. Wilson v, Oct 16 2012 *)
    Select[Range[300],Divisible[#,Total[IntegerDigits[#]]]&] (* Harvey P. Dale, Sep 07 2015 *)
  • PARI
    is(n)=n%sumdigits(n)==0 \\ Charles R Greathouse IV, Oct 16 2012
    
  • Python
    A005349 = [n for n in range(1,10**6) if not n % sum([int(d) for d in str(n)])] # Chai Wah Wu, Aug 22 2014
    
  • Sage
    [n for n in (1..10^4) if sum(n.digits(base=10)).divides(n)] # Freddy Barrera, Jul 27 2018
    

A154701 Numbers k such that k, k + 1 and k + 2 are 3 consecutive Harshad numbers.

Original entry on oeis.org

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
Offset: 1

Views

Author

Avik Roy (avik_3.1416(AT)yahoo.co.in), Jan 14 2009, Jan 15 2009

Keywords

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

Examples

			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.
		

References

  • Jean-Marie De Koninck, Those Fascinating Numbers, American Mathematical Society, 2009, p. 36, entry 110.

Crossrefs

Programs

  • C
    #include 
    #include 
    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; 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
    
  • 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 *)
  • 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

A330927 Numbers k such that both k and k + 1 are Niven numbers.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 20, 80, 110, 111, 132, 152, 200, 209, 224, 399, 407, 440, 480, 510, 511, 512, 629, 644, 735, 800, 803, 935, 999, 1010, 1011, 1014, 1015, 1016, 1100, 1140, 1160, 1232, 1274, 1304, 1386, 1416, 1455, 1520, 1547, 1651, 1679, 1728, 1853
Offset: 1

Views

Author

Amiram Eldar, Jan 03 2020

Keywords

Comments

Cooper and Kennedy proved that there are infinitely many runs of 20 consecutive Niven numbers. Therefore this sequence is infinite.

Examples

			1 is a term since 1 and 1 + 1 = 2 are both Niven numbers.
		

References

  • Jean-Marie De Koninck, Those Fascinating Numbers, American Mathematical Society, 2009, p. 36, entry 110.

Crossrefs

Programs

  • Magma
    f:=func; a:=[]; for k in [1..2000] do  if forall{m:m in [0..1]|f(k+m)} then Append(~a,k); end if; end for; a; // Marius A. Burtea, Jan 03 2020
    
  • Mathematica
    nivenQ[n_] := Divisible[n, Total @ IntegerDigits[n]]; nq1 = nivenQ[1]; seq = {}; Do[nq2 = nivenQ[k]; If[nq1 && nq2, AppendTo[seq, k - 1]]; nq1 = nq2, {k, 2, 2000}]; seq
    SequencePosition[Table[If[Divisible[n,Total[IntegerDigits[n]]],1,0],{n,2000}],{1,1}][[;;,1]] (* Harvey P. Dale, Dec 24 2023 *)
  • Python
    from itertools import count, islice
    def agen(): # generator of terms
        h1, h2 = 1, 2
        while True:
            if h2 - h1 == 1: yield h1
            h1, h2 = h2, next(k for k in count(h2+1) if k%sum(map(int, str(k))) == 0)
    print(list(islice(agen(), 52))) # Michael S. Branicky, Mar 17 2024

A330933 Starts of runs of 4 consecutive Niven numbers in base 2 (A049445).

Original entry on oeis.org

6222, 33102, 53262, 66702, 94830, 221550, 268302, 284910, 295182, 300750, 316590, 364110, 379950, 427470, 533950, 554190, 570030, 590862, 617550, 633390, 696750, 791790, 807630, 855150, 870990, 902670, 934350, 1081422, 1140270, 1282830, 1314510, 1330350, 1343502
Offset: 1

Views

Author

Amiram Eldar, Jan 03 2020

Keywords

Comments

Cai proved that there are infinitely many runs of 4 consecutive Niven numbers in base 2.
Grundman proved that there are no runs of 5 or more consecutive Niven numbers in base 2.

Examples

			6222 is a term since 6222, 6223, 6224 and 6225 are all Niven numbers in base 2.
		

References

  • József Sándor and Borislav Crstici, Handbook of Number theory II, Kluwer Academic Publishers, 2004, Chapter 4, p. 382.

Crossrefs

Programs

  • Magma
    f:=func; a:=[]; for k in [1..1400000] 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
  • Mathematica
    binNivenQ[n_] := Divisible[n, Total @ IntegerDigits[n, 2]]; bin = binNivenQ /@ Range[4]; seq = {}; Do[bin = Join[Rest[bin], {binNivenQ[k]}]; If[And @@ bin, AppendTo[seq, k - 3]], {k, 4, 10^6}]; seq

A328211 Starts of runs of 4 consecutive Zeckendorf-Niven numbers (A328208).

Original entry on oeis.org

1, 2, 3, 123543, 124242, 545502, 1367583, 1856349, 2431230, 2465110, 2593590, 2783709, 3247389, 3479229, 3917823, 3942909, 4174749, 4303428, 4494390, 4920640, 5143830, 5710383, 6261309, 6493149, 6552903, 6956829, 7420509, 7470880, 8970948, 9107790, 9507069, 10952928
Offset: 1

Views

Author

Amiram Eldar, Oct 07 2019

Keywords

Comments

Grundman proved that this sequence is infinite by showing the F(120k-6) + F(8) + F(6) + F(4) is a term for all k >= 1, where F(k) is the k-th Fibonacci number.
She also proved that the only starts of runs of 5 consecutive Zeckendorf-Niven numbers are 1 and 2.

Examples

			1 is in the sequence since 1, 2, 3 and 4 are in A328208: A007895(1) = 1 is a divisor of 1, A007895(2) = 1 is a divisor of 2, A007895(3) = 1 is a divisor of 3, and A007895(4) = 2 is a divisor of 4.
		

Crossrefs

Programs

  • Mathematica
    z[n_] := Length[DeleteCases[NestWhileList[# - Fibonacci[Floor[Log[Sqrt[5]*# + 3/2]/Log[GoldenRatio]]] &, n, # > 1 &], 0]]; aQ[n_] := Divisible[n, z[n]]; c = 0; k = 1; s = {}; v = Table[-1, {4}]; While[c < 32, If[aQ[k], v = Join[Rest[v], {k}]; If[AllTrue[Differences[v], # == 1 &], c++; AppendTo[s, k - 3]]]; k++]; s (* after Alonso del Arte at A007895 *)

A328215 Starts of runs of 4 consecutive lazy-Fibonacci-Niven numbers (A328212).

Original entry on oeis.org

3674769, 17434975, 22711023, 26152125, 32784723, 41221725, 57846123, 93416568, 101681916, 122873490, 173504940, 225947148, 234209247, 259557450, 333681684, 377858544, 396241410, 413770056, 432640989, 443496447, 444571650, 484381323, 497625360, 556123167, 564869940
Offset: 1

Views

Author

Amiram Eldar, Oct 07 2019

Keywords

Comments

Grundman found a(1) and proved that there are no runs of 5 consecutive lazy-Fibonacci-Niven numbers.

Examples

			3674769 is in the sequence since 3674769, 3674770, 3674771 and 3674772 are in A328212: A112310(3674769) = 21 is a divisor of 3674769, A112310(3674770) = 22 is a divisor of 3674770, A112310(3674771) = 17 is a divisor of 3674771, and A112310(3674772) = 18 is a divisor of 3674772.
		

Crossrefs

Programs

  • Mathematica
    ooQ[n_] := Module[{k = n}, While[k > 3, If[Divisible[k, 4], Return[True], k = Quotient[k, 2]]]; False]; c = 0; cn = 0; k = 1; s = {}; v = Table[-1, {4}]; While[cn < 10, If[! ooQ[k], c++; d = Total@IntegerDigits[k, 2]; If[Divisible[c, d], v = Join[Rest[v], {c}]; If[AllTrue[Differences[v], # == 1 &], cn++; AppendTo[s, c - 3]]]]; k++]; s

Extensions

More terms from Amiram Eldar, Oct 23 2019

A331824 Starts of runs of 4 consecutive positive negabinary-Niven numbers (A331728).

Original entry on oeis.org

1, 1264, 2104, 2944, 4624, 11888, 23768, 27312, 27728, 31688, 35648, 49144, 51488, 55448, 56704, 58384, 60072, 63424, 65104, 66784, 70144, 71288, 75248, 76452, 79208, 81904, 87128, 91088, 92832, 99008, 102968, 114848, 118808, 123904, 125592, 126728, 130624, 131044
Offset: 1

Views

Author

Amiram Eldar, Jan 27 2020

Keywords

Crossrefs

Programs

  • Mathematica
    negaBinWt[n_] := negaBinWt[n] = If[n == 0, 0, negaBinWt[Quotient[n - 1, -2]] + Mod[n, 2]]; negaBinNivenQ[n_] := Divisible[n, negaBinWt[n]]; nConsec = 4; neg = negaBinNivenQ /@ Range[nConsec]; seq = {}; c = 0; k = nConsec+1; While[c < 45, If[And @@ neg, c++; AppendTo[seq, k - nConsec]]; neg = Join[Rest[neg], {negaBinNivenQ[k]}]; k++]; seq

A342429 Starts of runs of 4 consecutive Niven numbers in base 3/2 (A342426).

Original entry on oeis.org

1649373, 4029519, 15281054, 31906263, 43387386, 58198173, 94468958, 100084949, 131393766, 131986502, 140282279, 156786124, 211004079, 246960048, 253000850, 278206663, 310135917, 330168203, 351204398, 363280904, 412296883, 504736647, 515831624, 537255647, 566300238
Offset: 1

Views

Author

Amiram Eldar, Mar 11 2021

Keywords

Comments

Are there 5 consecutive Niven numbers in base 3/2? There are no such numbers below 3*10^9.

Examples

			1649373 is a term since 1649373, 1649374, 1649375 and 1649376 are all Niven numbers in base 3/2.
		

Crossrefs

Subsequence of A342426, A342427 and A342428.
Similar sequences: A141769 (decimal), A328207 (factorial), A328211 (Zeckendorf), A328215 (lazy Fibonacci), A330933 (binary), A334311 (base phi), A331824 (negabinary).

Programs

  • Mathematica
    s[0] = 0; s[n_] := s[n] = s[2*Floor[n/3]] + Mod[n, 3]; q[n_] := Divisible[n, s[n]]; v = q /@ Range[4]; seq = {}; Do[v = Join[Rest[v], {q[k]}]; If[And @@ v, AppendTo[seq, k - 3]], {k, 4, 10^7}]; seq

A330928 Starts of runs of 5 consecutive Niven (or harshad) numbers (A005349).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 131052, 491424, 1275140, 1310412, 1474224, 1614623, 1912700, 2031132, 2142014, 2457024, 2550260, 3229223, 3931224, 4422624, 4914024, 5405424, 5654912, 5920222, 7013180, 7125325, 7371024, 8073023, 8347710, 9424832, 10000095, 10000096, 10000097
Offset: 1

Views

Author

Amiram Eldar, Jan 03 2020

Keywords

Comments

Cooper and Kennedy proved that there are infinitely many runs of 20 consecutive Niven numbers. Therefore this sequence is infinite.

Examples

			131052 is a term since 131052 is divisible by 1 + 3 + 1 + 0 + 5 + 2 = 12, 131053 is divisible by 13, 131054 is divisible by 14, 131055 is divisible by 15, and 131056 is divisible by 16.
		

References

  • Jean-Marie De Koninck, Those Fascinating Numbers, American Mathematical Society, 2009, p. 36, entry 110.

Crossrefs

Cf. A005349, A060159; A330927, A154701, A141769, A330929, A330930 (same for 2, 3, 4, 6, 7 consecutive harshad numbers).

Programs

  • Magma
    f:=func; a:=[]; for k in [1..11000000] do  if forall{m:m in [0..4]|f(k+m)} then Append(~a,k); end if; end for; a; // Marius A. Burtea, Jan 03 2020
    
  • Mathematica
    nivenQ[n_] := Divisible[n, Total @ IntegerDigits[n]]; niv = nivenQ /@ Range[5]; seq = {}; Do[niv = Join[Rest[niv], {nivenQ[k]}]; If[And @@ niv, AppendTo[seq, k - 4]], {k, 5, 10^7}]; seq
    SequencePosition[Table[If[Divisible[n,Total[IntegerDigits[n]]],1,0],{n,10^7+200}],{1,1,1,1,1}][[;;,1]] (* Harvey P. Dale, Dec 24 2023 *)
  • PARI
    {first( N=50, LEN=5, L=List())= for(n=1,oo, n+=LEN; for(m=1,LEN, n--%sumdigits(n) && next(2)); listput(L,n); N--|| break);L} \\ M. F. Hasler, Jan 03 2022

Formula

This A330928 = { A005349(k) | A005349(k+4) = A005349(k)+4 }. - M. F. Hasler, Jan 03 2022

A344344 Starts of runs of 4 consecutive Gray-code Niven numbers (A344341).

Original entry on oeis.org

1, 6, 30, 126, 510, 543, 783, 903, 2046, 2093, 3773, 3903, 7133, 7743, 8190, 8223, 8703, 10087, 12303, 12543, 14343, 14463, 15423, 15903, 16143, 16263, 20167, 22687, 27727, 30247, 30653, 30783, 32766, 35629, 40327, 47509, 47887, 49133, 50407, 57533, 60071, 60487
Offset: 1

Views

Author

Amiram Eldar, May 15 2021

Keywords

Comments

Are there 5 consecutive Gray-code Niven numbers? There are no such numbers below 10^10.

Examples

			1 is a term since 1, 2, 3 and 4 are all Gray-code Niven numbers.
		

Crossrefs

Subsequence of A344341, A344342 and A344343.
Similar sequences: A141769 (decimal), A328207 (factorial), A328211 (Zeckendorf), A328215 (lazy Fibonacci), A330933 (binary), A334311 (base phi), A331824 (negabinary), A342429 (base 3/2).

Programs

  • Mathematica
    gcNivenQ[n_] := Divisible[n, DigitCount[BitXor[n, Floor[n/2]], 2, 1]]; Select[Range[60000], AllTrue[# + {0, 1, 2, 3}, gcNivenQ] &]
Showing 1-10 of 26 results. Next