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.

A227378 Smallest number with n = sum of distinct digits in decimal representation, cf. A217928.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 29, 39, 49, 59, 69, 79, 89, 189, 289, 389, 489, 589, 689, 789, 1789, 2789, 3789, 4789, 5789, 6789, 16789, 26789, 36789, 46789, 56789, 156789, 256789, 356789, 456789, 1456789, 2456789, 3456789, 13456789, 23456789, 123456789
Offset: 0

Views

Author

Reinhard Zumkeller, Jul 09 2013

Keywords

Comments

A217928(a(n)) = A007953(a(n)) = n and A217928(m) < n for m < a(n).

Programs

  • Haskell
    import Data.List (elemIndex); import Data.Maybe (fromJust)
    a227378 = fromJust . (`elemIndex` a217928_list)

A007953 Digital sum (i.e., sum of digits) of n; also called digsum(n).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 8, 9, 10, 11, 12, 13, 14, 15
Offset: 0

Views

Author

R. Muller

Keywords

Comments

Do not confuse with the digital root of n, A010888 (first term that differs is a(19)).
Also the fixed point of the morphism 0 -> {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, 1 -> {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, 2 -> {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, etc. - Robert G. Wilson v, Jul 27 2006
For n < 100 equal to (floor(n/10) + n mod 10) = A076314(n). - Hieronymus Fischer, Jun 17 2007
It appears that a(n) is the position of 10*n in the ordered set of numbers obtained by inserting/placing one digit anywhere in the digits of n (except a zero before 1st digit). For instance, for n=2, the resulting set is (12, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 42, 52, 62, 72, 82, 92) where 20 is at position 2, so a(2) = 2. - Michel Marcus, Aug 01 2022
Also the total number of beads required to represent n on a Russian abacus (schoty). - P. Christopher Staecker, Mar 31 2023
a(n) / a(2n) <= 5 with equality iff n is in A169964, while a(n) / a(3n) is unbounded, since if n = (10^k + 2)/3, then a(n) = 3*k+1, a(3n) = 3, so a(n) / a(3n) = k + 1/3 -> oo when k->oo (see Diophante link). - Bernard Schott, Apr 29 2023
Also the number of symbols needed to write number n in Egyptian numerals for n < 10^7. - Wojciech Graj, Jul 10 2025

Examples

			a(123) = 1 + 2 + 3 = 6, a(9875) = 9 + 8 + 7 + 5 = 29.
		

Crossrefs

Programs

  • Haskell
    a007953 n | n < 10 = n
              | otherwise = a007953 n' + r where (n',r) = divMod n 10
    -- Reinhard Zumkeller, Nov 04 2011, Mar 19 2011
    
  • Magma
    [ &+Intseq(n): n in [0..87] ];  // Bruno Berselli, May 26 2011
    
  • Maple
    A007953 := proc(n) add(d,d=convert(n,base,10)) ; end proc: # R. J. Mathar, Mar 17 2011
  • Mathematica
    Table[Sum[DigitCount[n][[i]] * i, {i, 9}], {n, 50}] (* Stefan Steinerberger, Mar 24 2006 *)
    Table[Plus @@ IntegerDigits @ n, {n, 0, 87}] (* or *)
    Nest[Flatten[# /. a_Integer -> Array[a + # &, 10, 0]] &, {0}, 2] (* Robert G. Wilson v, Jul 27 2006 *)
    Total/@IntegerDigits[Range[0,90]] (* Harvey P. Dale, May 10 2016 *)
    DigitSum[Range[0, 100]] (* Requires v. 14 *) (* Paolo Xausa, May 17 2024 *)
  • PARI
    a(n)=if(n<1, 0, if(n%10, a(n-1)+1, a(n/10))) \\ Recursive, very inefficient. A more efficient recursive variant: a(n)=if(n>9, n=divrem(n, 10); n[2]+a(n[1]), n)
    
  • PARI
    a(n, b=10)={my(s=(n=divrem(n, b))[2]); while(n[1]>=b, s+=(n=divrem(n[1], b))[2]); s+n[1]} \\ M. F. Hasler, Mar 22 2011
    
  • PARI
    a(n)=sum(i=1, #n=digits(n), n[i]) \\ Twice as fast. Not so nice but faster:
    
  • PARI
    a(n)=sum(i=1,#n=Vecsmall(Str(n)),n[i])-48*#n \\ M. F. Hasler, May 10 2015
    /* Since PARI 2.7, one can also use: a(n)=vecsum(digits(n)), or better: A007953=sumdigits. [Edited and commented by M. F. Hasler, Nov 09 2018] */
    
  • PARI
    a(n) = sumdigits(n); \\ Altug Alkan, Apr 19 2018
    
  • Python
    def A007953(n):
        return sum(int(d) for d in str(n)) # Chai Wah Wu, Sep 03 2014
    
  • Python
    def a(n): return sum(map(int, str(n))) # Michael S. Branicky, May 22 2021
    
  • Scala
    (0 to 99).map(.toString.map(.toInt - 48).sum) // Alonso del Arte, Sep 15 2019
    
  • Smalltalk
    "Recursive version for general bases. Set base = 10 for this sequence."
    digitalSum: base
    | s |
    base = 1 ifTrue: [^self].
    (s := self // base) > 0
      ifTrue: [^(s digitalSum: base) + self - (s * base)]
      ifFalse: [^self]
    "by Hieronymus Fischer, Mar 24 2014"
    
  • Swift
    A007953(n): String(n).compactMap{$0.wholeNumberValue}.reduce(0, +) // Egor Khmara, Jun 15 2021

Formula

a(A051885(n)) = n.
a(n) <= 9(log_10(n)+1). - Stefan Steinerberger, Mar 24 2006
From Benoit Cloitre, Dec 19 2002: (Start)
a(0) = 0, a(10n+i) = a(n) + i for 0 <= i <= 9.
a(n) = n - 9*(Sum_{k > 0} floor(n/10^k)) = n - 9*A054899(n). (End)
From Hieronymus Fischer, Jun 17 2007: (Start)
G.f. g(x) = Sum_{k > 0, (x^k - x^(k+10^k) - 9x^(10^k))/(1-x^(10^k))}/(1-x).
a(n) = n - 9*Sum_{10 <= k <= n} Sum_{j|k, j >= 10} floor(log_10(j)) - floor(log_10(j-1)). (End)
From Hieronymus Fischer, Jun 25 2007: (Start)
The g.f. can be expressed in terms of a Lambert series, in that g(x) = (x/(1-x) - 9*L[b(k)](x))/(1-x) where L[b(k)](x) = sum{k >= 0, b(k)*x^k/(1-x^k)} is a Lambert series with b(k) = 1, if k > 1 is a power of 10, else b(k) = 0.
G.f.: g(x) = (Sum_{k > 0} (1 - 9*c(k))*x^k)/(1-x), where c(k) = Sum_{j > 1, j|k} floor(log_10(j)) - floor(log_10(j-1)).
a(n) = n - 9*Sum_{0 < k <= floor(log_10(n))} a(floor(n/10^k))*10^(k-1). (End)
From Hieronymus Fischer, Oct 06 2007: (Start)
a(n) <= 9*(1 + floor(log_10(n))), equality holds for n = 10^m - 1, m > 0.
lim sup (a(n) - 9*log_10(n)) = 0 for n -> oo.
lim inf (a(n+1) - a(n) + 9*log_10(n)) = 1 for n -> oo. (End)
a(n) = A138530(n, 10) for n > 9. - Reinhard Zumkeller, Mar 26 2008
a(A058369(n)) = A004159(A058369(n)); a(A000290(n)) = A004159(n). - Reinhard Zumkeller, Apr 25 2009
a(n) mod 2 = A179081(n). - Reinhard Zumkeller, Jun 28 2010
a(n) <= 9*log_10(n+1). - Vladimir Shevelev, Jun 01 2011
a(n) = a(n-1) + a(n-10) - a(n-11), for n < 100. - Alexander R. Povolotsky, Oct 09 2011
a(n) = Sum_{k >= 0} A031298(n, k). - Philippe Deléham, Oct 21 2011
a(n) = a(n mod b^k) + a(floor(n/b^k)), for all k >= 0. - Hieronymus Fischer, Mar 24 2014
Sum_{n>=1} a(n)/(n*(n+1)) = 10*log(10)/9 (Shallit, 1984). - Amiram Eldar, Jun 03 2021

Extensions

More terms from Hieronymus Fischer, Jun 17 2007
Edited by Michel Marcus, Nov 11 2013

A216407 Sum of decimal digits not appearing in n.

Original entry on oeis.org

45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 44, 44, 42, 41, 40, 39, 38, 37, 36, 35, 43, 42, 43, 40, 39, 38, 37, 36, 35, 34, 42, 41, 40, 42, 38, 37, 36, 35, 34, 33, 41, 40, 39, 38, 41, 36, 35, 34, 33, 32, 40, 39, 38, 37, 36, 40, 34, 33, 32, 31, 39, 38, 37, 36, 35, 34, 39, 32, 31, 30, 38, 37, 36, 35, 34, 33, 32, 38, 30, 29, 37, 36, 35, 34, 33, 32, 31, 30, 37, 28, 36, 35, 34, 33, 32, 31, 30, 29, 28, 36, 44
Offset: 0

Views

Author

Xenia Sheinerman, Oct 15 2012

Keywords

Programs

  • Haskell
    a216407 = (45 -) . a217928  -- Reinhard Zumkeller, Jul 09 2013
  • Mathematica
    Total[Complement[Range[0,9],IntegerDigits[#]]]&/@Range[0,100] (* Harvey P. Dale, Aug 13 2013 *)
  • PARI
    { a(n) = local( d = vecsort( eval(Vec(Str(n))),,8) ); 45 - sum(i=1,#d,d[i]) }
    

Formula

a(n) = 45 - A217928(n).
a(n) = 0 for almost all n. Average order is n^-0.045 where the exponent is log(0.9)/log(10). - Charles R Greathouse IV, Oct 15 2012

A280911 Numbers n such that sum of decimal digits of n equals number of prime divisors of n counted with multiplicity and sum of distinct decimal digits of n equals number of distinct primes dividing n.

Original entry on oeis.org

30, 102, 1002, 1012, 1210, 2001, 2120, 3010, 10002, 10030, 20001, 20112, 20120, 100012, 100030, 101020, 102010, 110020, 110120, 120001, 121120, 200001, 200120, 211100, 221120, 230010, 300010, 320320, 400010, 400140, 1000002, 1000012, 1000140, 1000230, 1001020, 1003002, 1004010, 1010120, 1011300, 1013310, 1021100
Offset: 1

Views

Author

Ilya Gutkovskiy, Jan 10 2017

Keywords

Comments

Numbers n such that A007953(n) = A001222(n) and A217928(n) = A001221(n).

Examples

			20112 is in the sequence because 20112 = 2^4*3*419  (6 prime factors, 3 distinct), 2 + 0 + 1 + 1 + 2 = 6 and 2 + 0 + 1 = 3.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[1100000], Total[IntegerDigits[#1]] == PrimeOmega[#1] && Total[Union[IntegerDigits[#1]]] == PrimeNu[#1] &]

A356981 Numbers k such that the sum of distinct digits of k equals the sum of the prime divisors of k.

Original entry on oeis.org

2, 3, 5, 7, 84, 144, 160, 250, 343, 468, 735, 936, 975, 1125, 1215, 1375, 1408, 1600, 1694, 1872, 2401, 2500, 2646, 2880, 3920, 4913, 6084, 6318, 6860, 7296, 7695, 8624, 8704, 8788, 9126, 10125, 10240, 10816, 11264, 12672, 12675, 14641, 14896, 16000
Offset: 1

Views

Author

Tanya Khovanova, Sep 09 2022

Keywords

Comments

Similar to A070275, where distinctness of digits is not required.

Examples

			144 = 2^4*3^2 and 1+4=2+3. Thus, 144 is in this sequence.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[2, 20000],Total[Union[IntegerDigits[#]]] ==  Total[Transpose[FactorInteger[#]][[1]]] &]
  • PARI
    isok(k) = vecsum(Set(digits(k))) == vecsum(factor(k)[, 1]); \\ Michel Marcus, Sep 12 2022
  • Python
    from itertools import count, islice
    from sympy import primefactors
    def A356981_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda k:sum(int(d) for d in set(str(k)))==sum(primefactors(k)), count(max(startvalue,1)))
    A356981_list = list(islice(A356981_gen(),30)) # Chai Wah Wu, Sep 12 2022
    

A357263 Numbers k such that the sum of the distinct digits of k is equal to the product of the prime divisors of k.

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 24, 343, 375, 392, 640, 686, 2401, 3375, 4802, 4913, 6400, 13122, 14336, 14641, 30375, 33614, 64000, 468750, 640000, 1703936, 2725888, 2839714, 2883584, 4687500, 5537792, 6298560, 6400000, 7864320, 13668750, 14172488, 19267584, 21807104, 26040609, 28629151
Offset: 1

Views

Author

Alexandru Petrescu, Sep 21 2022

Keywords

Comments

64*10^k is a term of the sequence for every positive integer k.

Examples

			375 = 3*5^3. 3+7+5 = 3*5. Thus 375 is a term.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[10^6], Plus @@ Union[IntegerDigits[#]] == Times @@ FactorInteger[#][[;;,1]] &] (* Amiram Eldar, Sep 21 2022 *)
  • PARI
    isok(k) = vecsum(Set(digits(k))) == vecprod(factor(k)[, 1]);
    
  • Python
    from math import prod
    from sympy import primefactors
    def ok(n): return n and sum(map(int, set(str(n)))) == prod(primefactors(n))
    print([k for k in range(10**5) if ok(k)]) # Michael S. Branicky, Sep 22 2022

Extensions

More terms from Michel Marcus, Sep 21 2022
Showing 1-6 of 6 results.