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

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)

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

A052022 Smallest number m larger than prime(n) such that prime(n) = sum of digits of m and prime(n) = largest prime factor of m (or 0 if no such number exists).

Original entry on oeis.org

12, 50, 70, 308, 364, 476, 1729, 4784, 9947, 8959, 38998, 588965, 179998, 1879859, 5988788, 38778989, 79693999, 287978998, 1489989599, 4595969989, 6888999949, 45999897788, 197999598599, 3999966997975, 6849998899886, 7885998969988, 35889999789995, 39969896999968
Offset: 2

Views

Author

Patrick De Geest, Nov 15 1999

Keywords

Comments

Does there exist a solution for every prime p?

Examples

			p=43 -> a(14)=179998 -> 1+7+9+9+9+8 = 43 and 179998 = 2*7*13*23*43. p=47 -> a(15)=1879859 -> 1+8+7+9+8+5+9 = 47 and 1879859 = 23*37*47*47.
		

Crossrefs

Programs

  • Maple
    A052022(n) = {
      local( p,m );
      p=prime(n) ;
      for(k=2,1000000000,
        m=k*p;
        if( A007953(m) == p && A006530(m) == p,
            return(m) ;
        )
      ) ;
    } # R. J. Mathar, Mar 02 2012
  • Mathematica
    snm[n_]:=Module[{k=2,p=Prime[n],m},m=k p;While[Total[ IntegerDigits[ m]]!=p||FactorInteger[m][[-1,1]]!=p,k++;m=k p];m]; Array[snm,18,2] (* Harvey P. Dale, Feb 28 2012 *)
  • PARI
    a(n) = my(p=prime(n), k=2, m=k*p); while ((sumdigits(m) != p) || (vecmax(factor(m)[,1]) != p), k++; m = k*p); m; \\ Michel Marcus, Apr 09 2021

Extensions

a(20)-a(29) from Donovan Johnson, May 09 2012

A138166 Numbers containing their length in their decimal representation.

Original entry on oeis.org

1, 12, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 42, 52, 62, 72, 82, 92, 103, 113, 123, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 143, 153, 163, 173, 183, 193, 203, 213, 223, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 243, 253, 263, 273, 283
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 03 2008

Keywords

Crossrefs

Cf. A038528 (subsequence).

Programs

  • Haskell
    import Data.List (isInfixOf)
    a138166 n = a138166_list !! (n-1)
    a138166_list = filter (\x -> show (a055642 x) `isInfixOf` show x) [0..]
    -- Reinhard Zumkeller, Jul 04 2012

A175688 Numbers k with property that arithmetic mean of its digits is both an integer and one of the digits of k.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 102, 111, 120, 123, 132, 135, 147, 153, 159, 174, 195, 201, 204, 210, 213, 222, 231, 234, 240, 243, 246, 258, 264, 285, 306, 312, 315, 321, 324, 333, 342, 345, 351, 354, 357, 360, 369, 375, 396, 402
Offset: 1

Views

Author

Claudio Meller, Aug 09 2010

Keywords

Comments

Subsequence of A061383.
A180160(a(n)) = 0. - Reinhard Zumkeller, Aug 15 2010

Examples

			135 is in the list because (1+3+5)/3 = 3 and 3 is a digit of 135.
		

Crossrefs

Programs

  • Haskell
    a175688 n = a175688_list !! (n-1)
    a175688_list = filter f [0..] where
       f x = m == 0 && ("0123456789" !! avg) `elem` show x
             where (avg, m) = divMod (a007953 x) (a055642 x)
    -- Reinhard Zumkeller, Jun 18 2013
  • Mathematica
    idQ[n_]:=Module[{idn=IntegerDigits[n],m},m=Mean[idn];IntegerQ[m] && MemberQ[idn,m]]; Select[Range[0,500],idQ] (* Harvey P. Dale, Jun 10 2011 *)

Extensions

Edited by Reinhard Zumkeller, Aug 13 2010

A119246 Numbers containing in decimal representation their digital root.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 19, 20, 29, 30, 39, 40, 49, 50, 59, 60, 69, 70, 79, 80, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 109, 118, 127, 128, 136, 138, 145, 148, 154, 158, 163, 168, 172, 178, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 198, 199, 200
Offset: 1

Views

Author

Reinhard Zumkeller, May 10 2006

Keywords

Comments

Complement of A119247.
For terms u: all digital permutations of u form terms; u*10 and all insertions of 0 are terms; if v is another term, then the concatenations uv, vu are also terms, as well as all insertions of v in u; these properties allow the construction of all terms beginning with {d:1<=d<=9}. - Reinhard Zumkeller, May 19 2006

Crossrefs

Programs

  • Haskell
    a119246 n = a119246_list !! (n-1)
    a119246_list =
        filter (\x -> a010888 x `elem` a031298_row (fromInteger x)) [0..]
    -- Reinhard Zumkeller, Dec 16 2013, Apr 14 2011
  • Mathematica
    d[n_] := IntegerDigits[n]; Select[Range[0, 200], MemberQ[d[#1], NestWhile[Total[d[#]] &, #1, # > 9 &]] &] (* Jayanta Basu, Jul 13 2013 *)

A227510 Numbers such that product of digits of n is positive and a substring of n.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 31, 41, 51, 61, 71, 81, 91, 111, 112, 113, 114, 115, 116, 117, 118, 119, 121, 126, 131, 141, 151, 153, 161, 171, 181, 191, 211, 236, 243, 311, 315, 324, 362, 411, 511, 611, 612
Offset: 1

Views

Author

Jayanta Basu, Jul 14 2013

Keywords

Comments

All numbers with at least one zero digit have a product of digits which is a substring; these have been kept out by the restriction on positivity.
The sequence is infinite: if n is a term 10n+1 is also a term. Are there any other patterns (except for prepending 1 to any term)? - Zak Seidov, Jul 24 2013
You can also insert 1 in any position outside the substring that gives the product of digits. - Robert Israel, Aug 26 2014
See also A203566 for a nontrivial subsequence of A203565. The zeroless members of the latter differ from this sequence from 212 on which is there but not here, while 236 is the first here but not there. - M. F. Hasler, Oct 14 2014

Examples

			The product of the digits of 236 is 36, a substring of 236, and hence 236 is a member.
		

Crossrefs

Programs

  • Maple
    filter:= proc(n)
      local L;
      L:= convert(n,base,10);
      if has(L,0) then return false fi;
      verify(convert(convert(L,`*`),base,10),L,'sublist');
    end proc:
    select(filter, [$1..1000]); # Robert Israel, Aug 26 2014
  • Mathematica
    Select[Range[650], FreeQ[x = IntegerDigits[#], 0] && MemberQ[FromDigits /@ Partition[x, IntegerLength[y = Times @@ x], 1], y] &]
  • PARI
    {isok(n)=d=digits(n);p=prod(i=1,#d,d[i]);k=1;while(p&&k<=(#d-#digits(p)+1),v=[];for(j=k,k+#digits(p)-1,v=concat(v,d[j]));if(v==digits(p),return(1));k++);return(0);}
    n=1;while(n<10^4,if(isok(n),print1(n,", "));n++) \\ Derek Orr, Aug 26 2014
    
  • PARI
    is_A227510(n)={(t=digits(prod(i=1,#n=digits(n),n[i])))&&for(i=0,#n-#t,vecextract(n,2^(i+#t)-2^i)==t&&return(1))} \\ M. F. Hasler, Oct 14 2014
  • Python
    from operator import mul
    from functools import reduce
    A227510 = [int(n) for n in (str(x) for x in range(1, 10**5)) if not n.count('0') and str(reduce(mul, (int(d) for d in n))) in n]
    # Chai Wah Wu, Aug 26 2014
    

Extensions

Edited by M. F. Hasler, Oct 14 2014
Showing 1-10 of 21 results. Next