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 33 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
    

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

A330932 Starts of runs of 3 consecutive Niven numbers in base 2 (A049445).

Original entry on oeis.org

623, 846, 2358, 4206, 4878, 6127, 6222, 6223, 12438, 16974, 21006, 27070, 31295, 33102, 33103, 35343, 37134, 37630, 37638, 40703, 43263, 45550, 48190, 49230, 52590, 53262, 53263, 56110, 59630, 66198, 66702, 66703, 67878, 69310, 69487, 72655, 74766, 77230, 77958
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. Therefore this sequence is infinite.

Examples

			623 is a term since 623, 624 and 625 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..80000] 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
  • Mathematica
    binNivenQ[n_] := Divisible[n, Total @ IntegerDigits[n, 2]]; bin = binNivenQ /@ Range[3]; seq = {}; Do[bin = Join[Rest[bin], {binNivenQ[k]}]; If[And @@ bin, AppendTo[seq, k - 2]], {k, 3, 8*10^4}]; seq

A141769 Beginning of a run of 4 consecutive Niven (or Harshad) numbers.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 510, 1014, 2022, 3030, 10307, 12102, 12255, 13110, 60398, 61215, 93040, 100302, 101310, 110175, 122415, 127533, 131052, 131053, 196447, 201102, 202110, 220335, 223167, 245725, 255045, 280824, 306015, 311232, 318800, 325600, 372112, 455422
Offset: 1

Views

Author

Sergio Pimentel, Sep 15 2008

Keywords

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

Examples

			510 is in the sequence because 510, 511, 512 and 513 are all Niven numbers.
		

References

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

Crossrefs

Cf. A005349, A330927, A154701, A330928, A330929, A330930, A060159 (start of run of 1, 2, ..., 7, exactly n consecutive Harshad numbers).
Cf. A330933, A328211, A328215 (analog for base 2, Zeckendorf- resp. Fibonacci-Niven variants).

Programs

  • Magma
    f:=func; 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
    
  • 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 *)
  • 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

Formula

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

Extensions

More terms from Amiram Eldar, Jan 03 2020

A328210 Starts of runs of 3 consecutive Zeckendorf-Niven numbers (A328208).

Original entry on oeis.org

1, 2, 3, 4, 12, 92, 236, 380, 1850, 2630, 4184, 7010, 8183, 8360, 11944, 12754, 13550, 16024, 17710, 17714, 18710, 20628, 22323, 22624, 25564, 28910, 31506, 36463, 36484, 39746, 40368, 44694, 48244, 49294, 53543, 58910, 59164, 64743, 70398, 75024, 77874, 78184
Offset: 1

Views

Author

Amiram Eldar, Oct 07 2019

Keywords

Examples

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

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, {3}]; While[c < 50, If[aQ[k], v = Join[Rest[v], {k}]; If[AllTrue[Differences[v], # == 1 &], c++; AppendTo[s, k - 2]]]; k++]; s (* after Alonso del Arte at A007895 *)

A328214 Starts of runs of 3 consecutive lazy-Fibonacci-Niven numbers (A328212).

Original entry on oeis.org

27312, 37504, 48060, 83248, 198254, 269856, 319694, 386136, 423520, 434300, 518175, 525672, 539800, 572184, 690858, 701118, 793799, 886534, 998866, 1015035, 1258444, 1396582, 1409058, 1511600, 1557422, 1680378, 1729398, 1753818, 2044768, 2136263, 2310624, 2396438, 2421024
Offset: 1

Views

Author

Amiram Eldar, Oct 07 2019

Keywords

Examples

			27312 is in the sequence since 27312, 27313 and 27314 are in A328212: A112310(27312) = 16 is a divisor of 27312, A112310(27312) = 13 is a divisor of 27313, and A112310(27314) = 14 is a divisor of 27314.
		

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, {3}]; While[cn < 33, 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 - 2]]]]; k++]; s

A331087 Starts of runs of 3 consecutive positive negaFibonacci-Niven numbers (A331085).

Original entry on oeis.org

4, 12, 86, 87, 88, 176, 230, 231, 232, 320, 464, 655, 1194, 1592, 1596, 1854, 1914, 2815, 3016, 3294, 4124, 4178, 4179, 4180, 4268, 4412, 5663, 5755, 8360, 9894, 10614, 10703, 10915, 10975, 13936, 14994, 15114, 15714, 17630, 18976, 19984, 20824, 21835, 23175, 23513
Offset: 1

Views

Author

Amiram Eldar, Jan 08 2020

Keywords

Comments

Numbers of the form F(6*k + 1) - 1, where F(m) is the m-th Fibonacci number, are terms.
Numbers of the form F(k) - 3, where k is congruent to {5, 11, 13, 19} mod 24 (A269819) are starts of runs of 5 consecutive negaFibonacci-Niven numbers.

Crossrefs

Programs

  • Mathematica
    ind[n_] := Floor[Log[Abs[n]*Sqrt[5] + 1/2]/Log[GoldenRatio]];
    f[1] = 1; f[n_] := If[n > 0, i = ind[n - 1]; If[EvenQ[i], i++]; i, i = ind[-n]; If[OddQ[i], i++]; i];
    negaFibTermsNum[n_] := Module[{k = n, s = 0}, While[k != 0, i = f[k]; s += 1; k -= Fibonacci[-i]]; s];
    negFibQ[n_] := Divisible[n, negaFibTermsNum[n]];
    nConsec = 3; neg = negFibQ /@ Range[nConsec]; seq = {}; c = 0; k = nConsec + 1; While[c < 55, If[And @@ neg, c++; AppendTo[seq, k - nConsec]];neg = Join[Rest[neg], {negFibQ[k]}]; k++]; seq

A333428 Starts of runs of 3 consecutive primorial base Niven numbers (A333426).

Original entry on oeis.org

64, 244, 424, 2344, 2524, 4624, 16180, 30064, 30244, 32344, 43900, 60064, 71620, 91408, 99340, 127060, 154780, 182500, 210220, 250936, 338632, 365860, 477280, 510544, 510724, 512824, 513160, 540544, 540880, 790900, 842884, 876988, 1021024, 1021648, 1024000, 1051720
Offset: 1

Views

Author

Amiram Eldar, Mar 20 2020

Keywords

Examples

			64 is a term since 64, 65 and 66 are all primorial base Niven numbers.
		

Crossrefs

Programs

  • Mathematica
    max = 7; bases = Prime @ Range[max, 1, -1]; nmax = Times @@ bases - 1; primNivenQ[n_] := Divisible[n, Plus @@ IntegerDigits[n, MixedRadix[bases]]]; q1 = primNivenQ[1]; q2 = primNivenQ[2]; seq = {}; Do[q3 = primNivenQ[n]; If[q1 && q2 && q3, AppendTo[seq, n - 2]]; q1 = q2; q2 = q3, {n, 3, nmax}]; seq

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

Original entry on oeis.org

2196, 7656, 15624, 16335, 64375, 109224, 171624, 202824, 328887, 329427, 392733, 393640, 447578, 482238, 494450, 520695, 631824, 723519, 773790, 785695, 820960, 876987, 981783, 986607, 1021824, 1026750, 1030455, 1084048, 1108094, 1160670, 1235070, 1242824, 1412908
Offset: 1

Views

Author

Amiram Eldar, Mar 11 2021

Keywords

Examples

			2196 is a term since 2196, 2197 and 2198 are all Niven numbers in base 3/2.
		

Crossrefs

Subsequence of A342426 and A342427.
Subsequences: A342429.
Similar sequences: A154701 (decimal), A328206 (factorial), A328210 (Zeckendorf), A328214 (lazy Fibonacci), A330932 (binary), A331087 (negaFibonacci), A333428 (primorial), A334310 (base phi), A331822 (negabinary).

Programs

  • Mathematica
    s[0] = 0; s[n_] := s[n] = s[2*Floor[n/3]] + Mod[n, 3]; q[n_] := Divisible[n, s[n]]; Select[Range[10^6], AllTrue[# + {0, 1, 2}, q] &]

A331822 Starts of runs of 3 consecutive positive negabinary-Niven numbers (A331728).

Original entry on oeis.org

1, 2, 14, 62, 124, 184, 244, 254, 304, 468, 484, 544, 784, 904, 964, 1022, 1084, 1098, 1144, 1264, 1265, 1308, 1448, 1504, 1518, 1924, 1938, 1984, 2044, 2104, 2105, 2358, 2888, 2944, 2945, 3064, 3198, 3248, 3424, 3544, 3604, 3618, 3664, 3828, 3844, 3904, 3964
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 = 3; neg = negaBinNivenQ /@ Range[nConsec]; seq = {}; c = 0; k = nConsec+1; While[c < 50, If[And @@ neg, c++; AppendTo[seq, k - nConsec]]; neg = Join[Rest[neg], {negaBinNivenQ[k]}]; k++]; seq
Showing 1-10 of 33 results. Next