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 13 results. Next

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

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

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

A330929 Starts of runs of 6 consecutive Niven (or Harshad) numbers (A005349).

Original entry on oeis.org

1, 2, 3, 4, 5, 10000095, 10000096, 12751220, 14250624, 22314620, 22604423, 25502420, 28501224, 35521222, 41441420, 41441421, 51004820, 56511023, 57002424, 70131620, 71042422, 71253024, 97740760, 102009620, 111573020, 114004824, 121136420, 124324220, 124324221
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

			10000095 is a term since 10000095 is divisible by 1 + 0 + 0 + 0 + 0 + 0 + 9 + 5 = 15, 10000096 is divisible by 16, ..., and 10000100 is divisible by 2.
		

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..30000000] do  if forall{m:m in [0..5]|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[6]; seq = {}; Do[niv = Join[Rest[niv], {nivenQ[k]}]; If[And @@ niv, AppendTo[seq, k - 5]], {k, 6, 10^7}]; seq

A330930 Starts of runs of 7 consecutive Niven (or Harshad) numbers (A005349).

Original entry on oeis.org

1, 2, 3, 4, 10000095, 41441420, 124324220, 124324221, 124324222, 207207020, 233735070, 331531220, 350602590, 409036350, 414414020, 467470110, 621621020, 621621021, 621621022, 1030302012, 1036035020, 1051807710, 1201800620, 1243242020, 1243242021, 1243242022
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

			10000095 is a term since 10000095 is divisible by 1 + 0 + 0 + 0 + 0 + 0 + 9 + 5 = 15, 10000096 is divisible by 16, ..., and 10000101 is divisible by 3.
		

References

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

Crossrefs

Programs

  • Mathematica
    nivenQ[n_] := Divisible[n, Total @ IntegerDigits[n]]; niv = nivenQ /@ Range[7]; seq = {}; Do[niv = Join[Rest[niv], {nivenQ[k]}]; If[And @@ niv, AppendTo[seq, k - 6]], {k, 7, 10^7}]; seq

A060288 Distinct (non-overlapping) twin Harshad numbers whose sum is prime.

Original entry on oeis.org

3, 7, 11, 19, 41, 401, 419, 449, 881, 1021, 1259, 1289, 1471, 1601, 1607, 1871, 1999, 2029, 2281, 2549, 2609, 2833, 3041, 3359, 3457, 4001, 4049, 4481, 4801, 5641, 6329, 7499, 7561, 8081, 8849, 8929, 9613, 9619, 10321, 11131, 12401, 12799, 13033
Offset: 1

Views

Author

Enoch Haga, Mar 23 2001

Keywords

Comments

Suggested by Puzzle 129, The Prime Puzzles and Problems Connection.

Examples

			a(3)=19, a prime, because the first Harshad number is 9 and the second is 10 and 9+10=19. To find the Harshad numbers take H1=(p-1)/2 as the first Harshad and then the second Harshad, H2=H1+1. Harshad numbers are those which have integral quotients after division by the sum of their digits. Note that 2+3=5 is not included because 1+2=3 are the first twins whose sum is prime and the next twins, 3+4=7, must not overlap the preceding pair.
		

Crossrefs

Programs

  • Mathematica
    harshadQ[n_] := Divisible[n, Plus @@ IntegerDigits[n]]; s = {}; q1 = True; Do[q2 = harshadQ[n]; If[q1 && q2, If[PrimeQ[2*n - 1], AppendTo[s, 2*n - 1]]; q1 = False, q1 = q2], {n, 2, 5000}]; s (* Amiram Eldar, Jan 19 2021 *)
  • UBASIC
    20 A=0; 30 inc A; 40 if Ct=2 then Z=(A-1)+(A-2): if Z=prmdiv(Z) then print A-2; "+"; A-1; "="; Z; "/"; :inc Pt; 50 if Ct=2 then Ct=1:A=A-1; 60 X=1; 70 B=str(A); 80 L=len(B); 90 inc X; 100 S=mid(B,X,1); 110 V=val(S):W=W+V; 120 if XDt+1 then Ct=0:Dt=0; 150 Dt=Ct:W=0; 160 if A<10000001 then 30; 170 print Pt;

Extensions

Offset corrected by Amiram Eldar, Jan 19 2021

A060290 Primes which are sums of twin Harshad numbers (includes overlaps).

Original entry on oeis.org

3, 5, 7, 11, 13, 17, 19, 41, 223, 401, 419, 449, 881, 1021, 1259, 1289, 1471, 1601, 1607, 1871, 1999, 2029, 2281, 2549, 2609, 2833, 3041, 3359, 3457, 4001, 4049, 4481, 4801, 4931, 5641, 6329, 7499, 7561, 8081, 8849, 8929, 9613, 9619, 10111, 10321
Offset: 1

Views

Author

Enoch Haga, Mar 24 2001

Keywords

Examples

			a(5)=17, a prime because the first Harshad number is 8 and the second is 9 and 8+9=17. In this sequence overlapping Harshad's are permitted: 1+2=3 and 2+3=5.
		

Crossrefs

Programs

  • Maple
    isA005349 := proc(n)
        if n mod digsum(n) = 0 then
            true;
        else
            false;
        end if;
    end proc:
    isA060290 := proc(n)
        local h1 ;
        if isprime(n) then
            h1 := (n-1)/2 ;
            if isA005349(h1) and isA005349(h1+1) then
                true;
            else
                false;
            end if;
        else
            false;
        end if;
    end proc:
    for n from 3 to 20000 do
        if isA060290(n) then
            printf("%d,",n) ;
        end if;
    end do: # R. J. Mathar, Dec 20 2013
  • Mathematica
    harshadQ[n_] := Divisible[n, Plus @@ IntegerDigits[n]]; s = {}; q1 = True; Do[q2 = harshadQ[n]; If[q1 && q2 && PrimeQ[2*n - 1], AppendTo[s, 2*n - 1]]; q1 = q2, {n, 2, 5000}]; s (* Amiram Eldar, Jan 19 2021 *)
  • UBASIC
    20 A=0;
    30 inc A;
    40 if Ct=2 then Z=(A-1)+(A-2): if Z=prmdiv(Z) then print A-2; "+"; A-1; "="; Z; "/"; :inc Pt;
    50 if Ct=2 then Ct=1:A=A-2;
    60 X=1;
    70 B=str(A);
    80 L=len(B);
    90 inc X;
    100 S=mid(B,X,1);
    110 V=val(S):W=W+V;
    120 if XDt+1 then Ct=0:Dt=0;
    150 Dt=Ct:W=0;
    160 if A<=10 then 30;
    170 print Pt;

Formula

{n in A000040: (n-1)/2 in A005349 and (n+1)/2 in A005349}. - R. J. Mathar, Dec 20 2013

Extensions

Offset corrected by Amiram Eldar, Jan 19 2021

A235397 The first term of the least sequence of n consecutive Moran numbers.

Original entry on oeis.org

18, 152, 3031, 21481224, 25502420, 4007565001480, 2196125475223740, 905295493763807066010
Offset: 1

Views

Author

Carlos Rivera, Jan 09 2014

Keywords

Comments

A number n is a Moran number if n divided by the sum of its decimal digits is prime.
From Amiram Eldar, Apr 25 2020: (Start)
Jens Kruse Andersen found that a(7) <= 2196125475223740 and a(8) <= 905295493763807066010 (see Rivera link).
Since Moran numbers (A001101) are also Niven numbers (A005349), this sequence is finite with no more than 20 terms (see A060159). (End)
a(9) <= 270140199032572375590810. - Giovanni Resta, Apr 30 2020

Examples

			a(6) = 4007565001480 because
4007565001480 = 40 * 100189125037,
4007565001481 = 41 * 97745487841,
4007565001482 = 42 * 95418214321,
4007565001483 = 43 * 93199186081,
4007565001484 = 44 * 91081022761,
4007565001485 = 45 * 89057000033.
		

Crossrefs

Programs

  • PARI
    isA001101(n)=(k->denominator(k)==1&&isprime(k))(n/sumdigits(n))
    a(n)=my(k=n); while(1, forstep(i=k,k-n+1,-1, if(!isA001101(i), k=i+n; next(2))); return(k-n+1)) \\ Charles R Greathouse IV, Jan 10 2014

Extensions

a(7)-a(8) from Giovanni Resta, Apr 27 2020

A060289 Number of distinct (non-overlapping) twin Harshad numbers whose sum is prime and where the 2nd Harshad is <= 10^n.

Original entry on oeis.org

4, 5, 17, 53, 250, 1404, 9013, 58608, 401614, 2908740, 21832530
Offset: 1

Views

Author

Enoch Haga, Mar 23 2001

Keywords

Examples

			a(1)=4 because there are four pairs of Harshads whose sum is prime and the 2nd Harshad in the pair is <=10; these are 1+2=3, 3+4=7, 5+6=11, 9+10=19. 8+9=17 is not included because this pair overlaps 7+8=15, which also happens to be not prime. (Another sequence might include such overlapping pairs.)
		

Crossrefs

Programs

  • Mathematica
    harshadQ[n_] := Divisible[n, Plus @@ IntegerDigits[n]]; c = 0; p = 10; s = {}; n = 0; k = 2; q1 = True; While[n <6, q2 = harshadQ[k]; If[q1 && q2, If[PrimeQ[2*k - 1],c++;If[k > p, n++; AppendTo[s, c-1]; p *= 10]]; q1 = False, q1 = q2];  k++]; s (* Amiram Eldar, Jan 19 2021 *)
  • PARI
    Niven(n)=n%sumdigits(n)==0
    a(n)=my(t,s); for(k=1,10^n,if(Niven(k), if(isprime(t+k), t=-10^n; s++); t=k)); s \\ Charles R Greathouse IV, Jan 23 2014

Formula

Generate the twin Harshads whose sum is prime. Count how many there are where the 2nd Harshad in the pair is <= a consecutive power of 10.

Extensions

a(8)-a(11) from Amiram Eldar, Jan 19 2021
Showing 1-10 of 13 results. Next