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-6 of 6 results.

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
    

A028834 Numbers whose sum of digits is a prime.

Original entry on oeis.org

2, 3, 5, 7, 11, 12, 14, 16, 20, 21, 23, 25, 29, 30, 32, 34, 38, 41, 43, 47, 49, 50, 52, 56, 58, 61, 65, 67, 70, 74, 76, 83, 85, 89, 92, 94, 98, 101, 102, 104, 106, 110, 111, 113, 115, 119, 120, 122, 124, 128, 131, 133, 137, 139, 140, 142, 146, 148, 151, 155, 157, 160, 164, 166, 173, 175, 179, 182
Offset: 1

Views

Author

Armand Turpel (armand(AT)vo.lu, armand_t(AT)geocities.com)

Keywords

Examples

			89 included because 8+9 = 17, which is prime.
		

Crossrefs

Cf. A010051; A046704 is a subsequence.
Complement of A104211.

Programs

  • Haskell
    a028834 n = a028834_list !! (n-1)
    a028834_list = filter ((== 1) . a010051 . a007953) [1..]
    -- Reinhard Zumkeller, Nov 13 2011
    
  • Maple
    a:=proc(n) local nn: nn:=convert(n,base,10): if isprime(sum(nn[j],j=1..nops(nn)))=true then n else fi end: seq(a(n),n=1..200); # Emeric Deutsch, Mar 17 2007
  • Mathematica
    Select[Range[200],PrimeQ[Total[IntegerDigits[#]]]&]  (* Harvey P. Dale, Feb 18 2011 *)
  • PARI
    is(n)=isprime(sumdigits(n)) \\ Felix Fröhlich, Aug 16 2014
    
  • Python
    from sympy import isprime
    def ok(n): return isprime(sum(map(int, str(n))))
    print(list(filter(ok, range(183)))) # Michael S. Branicky, Jun 18 2021
    
  • R
    require(gmp); which(sapply(1:1000, function(i) isprime(sum(floor(i/10^(0:(nchar(i)-1)))%%10)))==2) # Christian N. K. Anderson, Apr 22 2024
  • Sage
    [x for x in range(200) if (sum(Integer(x).digits(base=10))) in Primes()] # Bruno Berselli, May 05 2014
    

Extensions

More terms from Scott Lindhurst (ScottL(AT)alumni.princeton.edu)

A052018 Numbers k with the property that the sum of the digits of k is a substring of k.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 109, 119, 129, 139, 149, 159, 169, 179, 189, 199, 200, 300, 400, 500, 600, 700, 800, 900, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 1000, 1009, 1018, 1027, 1036, 1045, 1054, 1063
Offset: 1

Views

Author

Patrick De Geest, Nov 15 1999

Keywords

Crossrefs

Programs

  • Haskell
    import Data.List (isInfixOf)
    a052018 n = a052018_list !! (n-1)
    a052018_list = filter f [0..] where
       f x = show (a007953 x) `isInfixOf` show x
    -- Reinhard Zumkeller, Jun 18 2013
    
  • Mathematica
    sdssQ[n_]:=Module[{idn=IntegerDigits[n],s,len},s=Total[idn];len= IntegerLength[ s]; MemberQ[Partition[idn,len,1],IntegerDigits[s]]]; Join[{0},Select[Range[1100],sdssQ]] (* Harvey P. Dale, Jan 02 2013 *)
  • Python
    loop = (str(n) for n in range(399))
    print([int(n) for n in loop if str(sum(int(k) for k in n)) in n]) # Jonathan Frech, Jun 05 2017

A052019 Sum of digits of prime p is substring of p.

Original entry on oeis.org

2, 3, 5, 7, 109, 139, 149, 179, 199, 911, 919, 1009, 1063, 1109, 1163, 1181, 1327, 1381, 1409, 1427, 1481, 1609, 1627, 1663, 1709, 1811, 2099, 2137, 2399, 2699, 2711, 2713, 2719, 2999, 3613, 3617, 4513, 4517, 4519, 5413, 5417, 5419, 6113, 6133, 6143
Offset: 1

Views

Author

Patrick De Geest, Nov 15 1999

Keywords

Crossrefs

Programs

  • Mathematica
    fQ[n_] := Block[ {id = IntegerDigits@ n}, pid = Plus @@ id; MemberQ[ Partition[id, IntegerLength@ pid, 1], IntegerDigits@ pid]]; Select[ Prime@ Range@ 802, fQ] (* Robert G. Wilson v, Aug 16 2011 *)
    Select[Prime[Range[1000]],SequenceCount[IntegerDigits[#], IntegerDigits[ Total[ IntegerDigits[ #]]]]> 0&] (* The program uses the SequenceCount function from Mathematica version 10 *)  (* Harvey P. Dale, Sep 30 2015 *)

A052020 Sum of digits of k is a prime proper factor of k.

Original entry on oeis.org

12, 20, 21, 30, 50, 70, 102, 110, 111, 120, 133, 140, 200, 201, 209, 210, 230, 247, 300, 308, 320, 322, 364, 407, 410, 476, 481, 500, 506, 511, 605, 629, 700, 704, 715, 782, 803, 832, 874, 902, 935, 1002, 1010, 1011, 1015, 1020, 1040, 1066, 1088, 1100, 1101
Offset: 1

Views

Author

Patrick De Geest, Nov 15 1999

Keywords

Comments

For each prime p there are infinitely many terms with sum of digits p. - Robert Israel, Feb 26 2017

Crossrefs

Programs

  • Maple
    filter:= proc(n) local s;
      s:= convert(convert(n,base,10),`+`);
      isprime(s) and (n mod s = 0)
    end proc:
    select(filter, [$10..10^4]); # Robert Israel, Feb 26 2017
  • Mathematica
    Select[Range[0, 2000], With[{s = DigitSum[#]}, s < # && Divisible[#, s] && PrimeQ[s]] &] (* Paolo Xausa, May 18 2024 *)
  • Python
    from sympy import isprime
    def ok(n):
        sd = sum(map(int, str(n)))
        return 1 < sd < n and n%sd == 0 and isprime(sd)
    print([k for k in range(1102) if ok(k)]) # Michael S. Branicky, Dec 20 2021

A052021 Sum of digits of n is the largest prime factor of n.

Original entry on oeis.org

2, 3, 5, 7, 12, 50, 70, 308, 320, 364, 476, 500, 605, 700, 704, 715, 832, 935, 1088, 1183, 1547, 1729, 2401, 2584, 2618, 2704, 2926, 3080, 3200, 3536, 3640, 3952, 4225, 4760, 4784, 4913, 5000, 5491, 5525, 5819, 5831, 6050, 6175, 6517, 6647, 7000, 7040, 7150
Offset: 1

Views

Author

Patrick De Geest, Nov 15 1999

Keywords

Examples

			13685 has sum of digits '23' and 13685 = 5*7*17*'23'.
		

Crossrefs

Programs

  • Haskell
    a052021 n = a052021_list !! (n-1)
    a052021_list = tail $ filter (\x -> a007953 x == a006530 x) [1..]
    -- Reinhard Zumkeller, Nov 06 2011
  • Maple
    A007953 := proc(n) add(d,d=convert(n,base,10)) ; end proc:
    A006530 := proc(n) numtheory[factorset](n) ; max(op(%)) ; end proc:
    for n from 1 to 8000 do if A007953(n) = A006530(n) then printf("%d,",n) ; end if; end do: # R. J. Mathar, May 30 2010
  • Mathematica
    Select[Range[2,8000],FactorInteger[#][[-1,1]]==Total[IntegerDigits[#]]&] (* Harvey P. Dale, Oct 17 2012 *)

Formula

{n: A007953(n) = A006530(n)}. - R. J. Mathar, May 30 2010

Extensions

Single-digit primes added by R. J. Mathar, May 30 2010
Offset corrected by Reinhard Zumkeller, Nov 05 2011
Showing 1-6 of 6 results.