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

A269740 Index where A054683(n) appears in A270264.

Original entry on oeis.org

1, 5, 10, 25, 3, 7, 12, 73, 35, 4, 9, 16, 78, 43, 13, 17, 80, 54, 47, 15, 19, 88, 62, 48, 22, 93, 69, 92, 31, 24, 95, 81, 98, 63, 125, 83, 115, 67, 283, 127, 102, 122, 138, 296, 107, 140, 147, 320, 100, 6, 20, 33, 129, 116, 8, 23, 37, 133, 126, 26, 38, 136, 128
Offset: 1

Views

Author

N. J. A. Sloane, Mar 15 2016

Keywords

Comments

Conjectured to be a permutation of the positive numbers excluding 2.
This conjecture is equivalent to Polignac's conjecture. - Chai Wah Wu, Mar 15 2016

Crossrefs

Extensions

More terms from Chai Wah Wu, Mar 16 2016

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

A054684 Numbers whose sum of digits is odd.

Original entry on oeis.org

1, 3, 5, 7, 9, 10, 12, 14, 16, 18, 21, 23, 25, 27, 29, 30, 32, 34, 36, 38, 41, 43, 45, 47, 49, 50, 52, 54, 56, 58, 61, 63, 65, 67, 69, 70, 72, 74, 76, 78, 81, 83, 85, 87, 89, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 111, 113, 115, 117, 119, 120, 122, 124, 126, 128, 131
Offset: 1

Views

Author

Odimar Fabeny, Apr 19 2000

Keywords

Comments

Union of A179083 and A179085; A179081(a(n)) = 1. - Reinhard Zumkeller, Jun 28 2010
Equivalently, integers with an odd number of odd digits. - Bernard Schott, Nov 06 2022

Examples

			1, 3, 5, 7, 9, 10(1), 12(3), 14(5), 16(7), 18(9), 21(3) and so on.
		

Crossrefs

Cf. A054683, A137233 (number of n-digits terms).
Cf. A356929 (even number of even digits).
A294601 (exactly one odd decimal digit) is a subsequence.

Programs

  • Maple
    [seq(`if`(convert(convert(2*n-1,base,10),`+`)::odd, 2*n-1, 2*n-2), n=1..501)];
  • Mathematica
    Select[Range[200],OddQ[Total[IntegerDigits[#]]]&] (* Harvey P. Dale, Nov 27 2021 *)
  • PARI
    is(n)=my(d=digits(n));sum(i=1,#d,d[i])%2 \\ Charles R Greathouse IV, Aug 09 2013
    
  • PARI
    isok(m) = sumdigits(m) % 2; \\ Michel Marcus, Nov 06 2022
    
  • PARI
    a(n) = n=2*(n-1); n + !(sumdigits(n)%2); \\ Kevin Ryde, Nov 07 2022
    
  • Python
    def ok(n): return sum(map(int, str(n)))&1
    print([k for k in range(132) if ok(k)]) # Michael S. Branicky, Nov 06 2022

Formula

a(n) = n * 2 - 1 for the first 5 numbers; a(n) = n * 2 for the second 5 numbers.
From Robert Israel, Jun 27 2017: (Start)
a(n) = 2*n-2 if floor((n-1)/5) is in the sequence, 2*n-1 if not.
G.f. g(x) satisfies g(x) = (1-x)*(1+x+x^2+x^3+x^4)^2*g(x^10)/x^9 + x^2*(2+x^4+3*x^5-x^9+3*x^10)/((1-x)*(1+x^5))^2.
(End)

Extensions

More terms from James Sellers, Apr 19 2000

A179082 Even numbers having an even sum of digits in their decimal representation.

Original entry on oeis.org

0, 2, 4, 6, 8, 20, 22, 24, 26, 28, 40, 42, 44, 46, 48, 60, 62, 64, 66, 68, 80, 82, 84, 86, 88, 110, 112, 114, 116, 118, 130, 132, 134, 136, 138, 150, 152, 154, 156, 158, 170, 172, 174, 176, 178, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 220, 222, 224, 226
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 28 2010

Keywords

Comments

a(n) = A014263(n) for n <= 25;
intersection of A005843 and A054683: A059841(a(n))*(1-A179081(a(n)))=1;
complement of A179083 with respect to A005843;
complement of A179084 with respect to A054683;
a(n) mod 2 = 0 and A007953(a(n)) mod 2 = 0.

Programs

  • Mathematica
    Select[Range[0,250,2],EvenQ[Total[IntegerDigits[#]]]&] (* Harvey P. Dale, Mar 19 2012 *)

A179081 Parity of sum of digits of n.

Original entry on oeis.org

0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1
Offset: 0

Views

Author

Reinhard Zumkeller, Jun 28 2010

Keywords

Comments

a(n) = A000035(A007953(n));
characteristic function of numbers with an odd sum of digits in their decimal representation:
a(A054684(n)) = 1; a(A054683(n)) = 0;
a(A179083(n)) = a(A179085(n)) = 1;
a(A179082(n)) = a(A179084(n)) = 0.

Examples

			a(789) = (7+8+9) mod 2 = 0;
a(790) = (7+9+0) mod 2 = 0;
a(791) = (7+9+1) mod 2 = 1.
		

Programs

  • Mathematica
    Array[Mod[Total[IntegerDigits[#]],2]&,110,0] (* Harvey P. Dale, Feb 20 2013 *)
  • PARI
    a(n) = vecsum(digits(n)) % 2 \\ Jeppe Stig Nielsen, Jan 06 2018

Formula

a(n) = if n<10 then (n mod 2) else a([n/10]) XOR (n mod 2).

A119449 Primes with even digit sum.

Original entry on oeis.org

2, 11, 13, 17, 19, 31, 37, 53, 59, 71, 73, 79, 97, 101, 103, 107, 109, 127, 149, 163, 167, 181, 211, 233, 239, 251, 257, 271, 277, 293, 307, 347, 349, 367, 383, 389, 419, 431, 433, 439, 457, 479, 491, 499, 503, 509, 521, 523, 541, 547, 563, 569, 587, 613, 617
Offset: 1

Views

Author

Zak Seidov, May 20 2006

Keywords

Comments

On average, there are as many prime numbers for which the sum of decimal digits is even as prime numbers for which it is odd [A119450]. This hypothesis, first made in 1968, has recently been proved by researchers from the Institut de Mathematiques de Luminy. - Jonathan Vos Post, May 13 2010
Also primes such that absolute value of difference between largest digit and the sum of all the other digits is an even integer. This is in accordance with hypothesis of Alexandre Gelfond, proved by C. Mauduit and J. Rivat, see the link below. - Osama Abuajamieh, Feb 10 2017.

Crossrefs

Intersection of A054683 and A000040.
Primes with odd digit sum A119450.

Programs

  • Mathematica
    Select[Prime@ Range@ 113, EvenQ@ Total@ IntegerDigits@ # &] (* Michael De Vlieger, Feb 11 2017 *)
  • PARI
    isok(n) = isprime(n) && (sumdigits(n) % 2 == 0); \\ Michel Marcus, Oct 10 2013

A179084 Odd numbers having an even sum of digits in their decimal representation.

Original entry on oeis.org

11, 13, 15, 17, 19, 31, 33, 35, 37, 39, 51, 53, 55, 57, 59, 71, 73, 75, 77, 79, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 121, 123, 125, 127, 129, 141, 143, 145, 147, 149, 161, 163, 165, 167, 169, 181, 183, 185, 187, 189, 211, 213, 215, 217, 219, 231, 233, 235
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 28 2010

Keywords

Comments

Intersection of A005408 and A054683: A000035(a(n))*(1-A179081(a(n)))=1;
complement of A179085 with respect to A005408;
complement of A179082 with respect to A054683;
a(n) mod 2 = 1 and A007953(a(n)) mod 2 = 0.

A119894 Numbers k such that 2^k, 3^k, 5^k, 7^k and 11^k have even digit sum.

Original entry on oeis.org

64, 90, 106, 168, 181, 185, 229, 242, 369, 407, 447, 470, 481, 503, 552, 568, 583, 612, 648, 657, 683, 684, 742, 758, 804, 811, 852, 863, 896, 915, 924, 928, 1000, 1004, 1068, 1103, 1113, 1126, 1182, 1402, 1410, 1412, 1420, 1428, 1473, 1483, 1484, 1546, 1566
Offset: 1

Views

Author

Zak Seidov, May 26 2006

Keywords

Crossrefs

Programs

  • Mathematica
    edsQ[n_]:=And@@EvenQ[Total[IntegerDigits[#]]&/@(Prime[Range[5]]^n)]; Select[Range[1600],edsQ]  (* Harvey P. Dale, Apr 21 2011 *)

A119897 Numbers k such that 2^k, 3^k, 5^k, 7^k, 11^k, 13^k, 17^k and 19^k have even digit sum.

Original entry on oeis.org

552, 657, 811, 1412, 1655, 2390, 2504, 2721, 2803, 2902, 3002, 3060, 3135, 3393, 3660, 4414, 4500, 4547, 4750, 4787, 4824, 5036, 5539, 5906, 6782, 7728, 8650, 9263, 9873, 9953, 10367, 10643, 10684, 10723, 11369, 11647, 11867, 11954
Offset: 1

Views

Author

Zak Seidov, May 26 2006

Keywords

Crossrefs

Programs

  • Mathematica
    edsQ[n_]:=AllTrue[Prime[Range[8]]^n,EvenQ[Total[IntegerDigits[#]]]&]; Select[ Range[12000],edsQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, May 10 2017 *)

Extensions

More terms from Harvey P. Dale, May 10 2017

A067510 Powers of 6 with digit sum divisible by 6.

Original entry on oeis.org

6, 1296, 279936, 1679616, 10077696, 60466176, 13060694016, 78364164096, 2821109907456, 16926659444736, 101559956668416, 3656158440062976, 789730223053602816, 4738381338321616896, 28430288029929701376
Offset: 1

Views

Author

Amarnath Murthy, Feb 11 2002

Keywords

Crossrefs

Programs

  • Maple
    select(n -> convert(convert(n,base,10),`+`)::even, [seq(6^i, i=1..100)]); # Robert Israel, Apr 20 2020

Extensions

Offset changed by Robert Israel, Apr 20 2020
Showing 1-10 of 19 results. Next