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.

Previous Showing 11-20 of 22 results. Next

A053832 Sum of digits of n written in base 12.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Mar 28 2000

Keywords

Comments

Also the fixed point of the morphism 0->{0,1,2,3,4,5,6,7,8,9,10,11}, 1->{1,2,3,4,5,6,7,8,9,10,11,12}, 2->{2,3,4,5,6,7,8,9,10,11,12,13}, etc. - Robert G. Wilson v, Jul 27 2006

Examples

			a(20) = 1 + 8 = 9 because 20 is written as 18 base 12.
		

Crossrefs

Programs

  • Haskell
    a053832 n = q 0 $ divMod n 12 where
       q r (0, d) = r + d
       q r (m, d) = q (r + d) $ divMod m 12
    -- Reinhard Zumkeller, May 15 2011
  • Mathematica
    Table[Plus @@ IntegerDigits[n, 12], {n, 0, 85}] (* or *)
    Nest[ Flatten[ #1 /. a_Integer -> Table[a + i, {i, 0, 11}]] &, {0}, 2] (* Robert G. Wilson v, Jul 27 2006 *)
  • PARI
    a(n)=if(n<1,0,if(n%12,a(n-1)+1,a(n/12)))
    

Formula

From Benoit Cloitre, Dec 19 2002: (Start)
a(0) = 0, a(12n+i) = a(n)+i for 0 <= i <= 11.
a(n) = n-11*(Sum_{k>0} floor(n/12^k)) = n-11*A064459(n). (End)
a(n) = A138530(n,12) for n > 11. - Reinhard Zumkeller, Mar 26 2008
Sum_{n>=1} a(n)/(n*(n+1)) = 12*log(12)/11 (Shallit, 1984). - Amiram Eldar, Jun 03 2021

A053831 Sum of digits of n written in base 11.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Mar 28 2000

Keywords

Comments

Also the fixed point of the morphism 0->{0,1,2,3,4,5,6,7,8,9,10}, 1->{1,2,3,4,5,6,7,8,9,10,11}, 2->{2,3,4,5,6,7,8,9,10,11,12}, etc. - Robert G. Wilson v, Jul 27 2006

Examples

			a(20) = 1 + 9 = 10 because 20 is written as 19 base 11.
		

Crossrefs

Sum of digits of n written in bases 2-16: A000120, A053735, A053737, A053824, A053827, A053828, A053829, A053830, A007953, this sequence, A053832, A053833, A053834, A053835, A053836.

Programs

  • C
    int Base11DigitSum(int n) {
       int count = 0;
       while (n != 0) { count += n % 11; n = n / 11; }
       return count;
    } // Tanar Ulric, Oct 20 2021
  • Mathematica
    Table[Plus @@ IntegerDigits[n, 11], {n, 0, 86}] (* or *)
    Nest[ Flatten[ #1 /. a_Integer -> Table[a + i, {i, 0, 10}]] &, {0}, 2] (* Robert G. Wilson v, Jul 27 2006 *)
  • PARI
    a(n)=if(n<1,0,if(n%11,a(n-1)+1,a(n/11)))
    
  • PARI
    a(n)=sumdigits(n,11) \\ Charles R Greathouse IV, Oct 20 2021
    

Formula

From Benoit Cloitre, Dec 19 2002: (Start)
a(0)=0, a(11n+i) = a(n)+i for 0 <= i <= 10.
a(n) = n-(m-1)*(Sum_{k>0} floor(n/m^k)) = n-(m-1)*A064458(n). (End)
a(n) = A138530(n,11) for n > 10. - Reinhard Zumkeller, Mar 26 2008
Sum_{n>=1} a(n)/(n*(n+1)) = 11*log(11)/10 (Shallit, 1984). - Amiram Eldar, Jun 03 2021

A053833 Sum of digits of n written in base 13.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Mar 28 2000

Keywords

Examples

			a(20) = 1 + 7 = 8 because 20 is written as "17" in base 13.
		

Crossrefs

Programs

  • Mathematica
    Total[IntegerDigits[#,13]]&/@Range[0,90]  (* Harvey P. Dale, Jul 17 2012 *)
  • PARI
    a(n)=if(n<1,0,if(n%13,a(n-1)+1,a(n/13)))

Formula

From Benoit Cloitre, Dec 19 2002: (Start)
a(0) = 0, a(13n+i) = a(n)+i for 0 <= i <= 12.
a(n) = n-12*(Sum_{k>0} floor(n/13^k)). (End)
a(n) = A138530(n,13) for n > 12. - Reinhard Zumkeller, Mar 26 2008
Sum_{n>=1} a(n)/(n*(n+1)) = 13*log(13)/12 (Shallit, 1984). - Amiram Eldar, Jun 03 2021

A053834 Sum of digits of n written in base 14.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Mar 28 2000

Keywords

Examples

			a(20) = 1 + 6 = 7 because 20 is written as "16" in base 14.
		

Crossrefs

Programs

  • Mathematica
    Array[Total[IntegerDigits[#,14]]&,90,0] (* Harvey P. Dale, Jul 16 2011 *)
  • PARI
    a(n)=if(n<1,0,if(n%14,a(n-1)+1,a(n/14)))
    
  • PARI
    a(n) = sumdigits(n, 14); \\ Michel Marcus, Jun 03 2021

Formula

From Benoit Cloitre, Dec 19 2002: (Start)
a(0) = 0, a(14n+i) = a(n)+i for 0 <= i <= 13.
a(n) = n-13*(Sum_{k>0} floor(n/14^k)). (End)
a(n) = A138530(n,14) for n > 13. - Reinhard Zumkeller, Mar 26 2008
Sum_{n>=1} a(n)/(n*(n+1)) = 14*log(14)/13 (Shallit, 1984). - Amiram Eldar, Jun 03 2021

A053835 Sum of digits of n written in base 15.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Mar 28 2000

Keywords

Examples

			a(20) = 1 + 5 = 6 because 20 is written as "15" in base 15.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Total[IntegerDigits[n, 15]]; Array[a, 100, 0] (* Amiram Eldar, Aug 03 2023 *)
  • PARI
    a(n)=if(n<1,0,if(n%15,a(n-1)+1,a(n/15)))

Formula

From Benoit Cloitre, Dec 19 2002: (Start)
a(0) = 0, a(15n+i) = a(n)+i, 0<=i<=14.
a(n) = n - 14*(Sum_{k>0} floor(n/15^k)). (End)
a(n) = A138530(n,15) for n > 14. - Reinhard Zumkeller, Mar 26 2008
Sum_{n>=1} a(n)/(n*(n+1)) = 15*log(15)/14 (Shallit, 1984). - Amiram Eldar, Aug 03 2023

A240236 Triangle read by rows: sum of digits of n in base k, for 2<=k<=n.

Original entry on oeis.org

1, 2, 1, 1, 2, 1, 2, 3, 2, 1, 2, 2, 3, 2, 1, 3, 3, 4, 3, 2, 1, 1, 4, 2, 4, 3, 2, 1, 2, 1, 3, 5, 4, 3, 2, 1, 2, 2, 4, 2, 5, 4, 3, 2, 1, 3, 3, 5, 3, 6, 5, 4, 3, 2, 1, 2, 2, 3, 4, 2, 6, 5, 4, 3, 2, 1, 3, 3, 4, 5, 3, 7, 6, 5, 4, 3, 2, 1, 3, 4, 5, 6, 4, 2, 7, 6, 5, 4, 3, 2, 1
Offset: 2

Views

Author

Keywords

Examples

			Triangle starts:
  1
  2 1
  1 2 1
  2 3 2 1
  2 2 3 2 1
  3 3 4 3 2 1
		

Crossrefs

Row sums give A043306.
See A138530 for another version.

Programs

  • Haskell
    a240236 n k = a240236_tabl !! (n-1) !! (k-1)
    a240236_row n = a240236_tabl !! (n-1)
    a240236_tabl = zipWith (map . flip q)
                           [2..] (map tail $ tail a002260_tabl) where
       q b n = if n < b then n else q b n' + d where (n', d) = divMod n b
    -- Reinhard Zumkeller, Apr 29 2015
  • Mathematica
    Table[Total[Flatten[IntegerDigits[n,k]]],{n,20},{k,2,n}]//Flatten (* Harvey P. Dale, Jan 13 2025 *)
  • PARI
    T(n,k) = local(r=0);if(k<2,-1,while(n>0,r+=n%k;n\=k);r)
    
  • PARI
    T(n, k) = sumdigits(n, k) \\ Zhuorui He, Aug 25 2025
    

Formula

T(n,k) = n - (k - 1) * Sum_{i=1..floor(log_k(n))} floor(n/k^i). - Ridouane Oudra, Sep 27 2024
T(n,k) = n - (k - 1) * A090623(n,k). - Zhuorui He, Aug 25 2025

A131383 Total digital sum of n: sum of the digital sums of n for all the bases 1 to n (a 'digital sumorial').

Original entry on oeis.org

1, 3, 6, 8, 13, 16, 23, 25, 30, 35, 46, 46, 59, 66, 75, 74, 91, 91, 110, 112, 125, 136, 159, 152, 169, 182, 195, 199, 228, 223, 254, 253, 274, 291, 316, 297, 334, 353, 378, 373, 414, 409, 452, 460, 475, 498, 545, 520, 557, 565, 598, 608, 661, 652, 693, 690
Offset: 1

Views

Author

Hieronymus Fischer, Jul 05 2007, Jul 15 2007, Jan 07 2009

Keywords

Comments

Sums of rows of the triangle in A138530. - Reinhard Zumkeller, Mar 26 2008

Examples

			5 = 11111(base 1) = 101(base 2) = 12(base 3) = 11(base 4) = 10(base 5). Thus a(5) = ds_1(5)+ds_2(5)+ds_3(5)+ds_4(5)+ds_5(5) = 5+2+3+2+1 = 13.
		

Crossrefs

Programs

  • Mathematica
    Table[n + Total@ Map[Total@ IntegerDigits[n, #] &, Range[2, n]], {n, 56}] (* Michael De Vlieger, Jan 03 2017 *)
  • PARI
    a(n)=sum(i=2,n+1,vecsum(digits(n,i))); \\ R. J. Cano, Jan 03 2017

Formula

a(n) = n^2-sum{k>0, sum{2<=p<=n, (p-1)*floor(n/p^k)}}.
a(n) = n^2-sum{2<=p<=n, (p-1)*sum{0
a(n) = n^2-A024916(n)+A006218(n)-sum{k>1, sum{2<=p<=n, (p-1)*floor(n/p^k)}}.
a(n) = A004125(n)+A006218(n)-sum{k>1, sum{2<=p<=n, (p-1)*floor(n/p^k)}}.
Asymptotic behavior: a(n) = (1-Pi^2/12)*n^2 + O(n*log(n)) = A004125(n) + A006218(n) + O(n*log(n)).
Lim a(n)/n^2 = 1 - Pi^2/12 for n-->oo.
G.f.: (1/(1-x))*(x(1+x)/(1-x)^2-sum{k>0,sum{j>1,(j-1)*x^(j^k)/(1-x^(j^k))}= }).
Also: (1/(1-x))*(x(1+x)/(1-x)^2-sum{m>1, sum{10,j^(1/k) is an integer, j^(1/k)-1}}*x^m}).
a(n) = n^2-sum{10,sum{1
Recurrence: a(n)=a(n-1)-b(n)+2n-1, where b(n)=sum{1
a(n) = sum{1<=p<=n, ds_p(n)} where ds_p = digital sum base p.
a(n) = A043306(n) + n (that sequence ignores unary) = A014837(n) + n + 1 (that sequence ignores unary and base n in which n is "10"). - Alonso del Arte, Mar 26 2009

A339541 a(n) = n + sod(n, sod(n, 10)), where sod(n,b) is the sum of base-b digits of n.

Original entry on oeis.org

2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 14, 14, 17, 20, 20, 20, 20, 20, 29, 22, 24, 26, 30, 28, 32, 31, 30, 38, 38, 32, 38, 36, 41, 44, 42, 40, 47, 46, 45, 44, 46, 44, 50, 53, 50, 56, 54, 52, 62, 52, 57, 56, 64, 60, 65, 62, 70, 68, 66, 65, 68, 75, 70, 74, 80, 77, 74, 84, 82, 74, 79, 80, 83, 88, 84, 92
Offset: 1

Author

Robert Israel, Dec 08 2020

Keywords

Examples

			a(15) = 15 + 5 = 20 because sod(15,10) = 6 and sod(15,6) = 5 (because 15 = 23_6).
		

Crossrefs

Programs

  • Maple
    sod:= proc(x,b) if b=1 then x else convert(convert(x,base,b),`+`) fi end proc:
    f:= x -> x + sod(x,sod(x,10)):
    map(f, [$1..100]);

Formula

a(n) = n + A138530(n, A007953(n)).

A339542 Primes p such that A339541(p) is prime.

Original entry on oeis.org

2, 13, 19, 37, 71, 73, 127, 163, 167, 181, 271, 293, 307, 367, 431, 433, 457, 503, 569, 631, 659, 811, 907, 983, 1009, 1087, 1153, 1171, 1229, 1373, 1399, 1409, 1423, 1483, 1487, 1511, 1597, 1777, 1801, 1861, 1867, 1999, 2017, 2039, 2053, 2143, 2239, 2273, 2297, 2341, 2383, 2437, 2477, 2521, 2659
Offset: 1

Author

J. M. Bergot and Robert Israel, Dec 08 2020

Keywords

Comments

Primes p such that p + A138530(p, A007953(p)) is prime.

Examples

			a(5) = 71 is in the sequence because sod(71,10) = 8, sod(71,8) = 8 (since 71 = 107_8), and 71+8=79 is prime.
		

Crossrefs

Programs

  • Maple
    sod:= proc(x,b) if b=1 then x else convert(convert(x,base,b),`+`) fi end proc:
    select(p -> isprime(p+sod(p,sod(p,10))), [seq(ithprime(i),i=1..1000)]);

A356517 Square array A(n, k), n >= 2, k >= 0, read by antidiagonals upwards; A(n, k) is the least integer with sum of digits k in base n.

Original entry on oeis.org

0, 0, 1, 0, 1, 3, 0, 1, 2, 7, 0, 1, 2, 5, 15, 0, 1, 2, 3, 8, 31, 0, 1, 2, 3, 7, 17, 63, 0, 1, 2, 3, 4, 11, 26, 127, 0, 1, 2, 3, 4, 9, 15, 53, 255, 0, 1, 2, 3, 4, 5, 14, 31, 80, 511, 0, 1, 2, 3, 4, 5, 11, 19, 47, 161, 1023, 0, 1, 2, 3, 4, 5, 6, 17, 24, 63, 242, 2047
Offset: 2

Author

Rémy Sigrist, Aug 10 2022

Keywords

Comments

The expansion of A(n, k) in base n is:
q n-1 ... n-1
<- p times ->
where q = k mod (n-1) and p = floor(k / (n-1)).

Examples

			Array A(n, k) begins:
  n\k|  0  1  2  3   4   5   6    7    8    9    10    11    12
  ---+---------------------------------------------------------
    2|  0  1  3  7  15  31  63  127  255  511  1023  2047  4095
    3|  0  1  2  5   8  17  26   53   80  161   242   485   728
    4|  0  1  2  3   7  11  15   31   47   63   127   191   255
    5|  0  1  2  3   4   9  14   19   24   49    74    99   124
    6|  0  1  2  3   4   5  11   17   23   29    35    71   107
    7|  0  1  2  3   4   5   6   13   20   27    34    41    48
    8|  0  1  2  3   4   5   6    7   15   23    31    39    47
    9|  0  1  2  3   4   5   6    7    8   17    26    35    44
   10|  0  1  2  3   4   5   6    7    8    9    19    29    39
Array A(n, k) begins (with values given in base n):
  n\k|  0  1   2    3     4      5       6        7         8          9
  ---+------------------------------------------------------------------
    2|  0  1  11  111  1111  11111  111111  1111111  11111111  111111111
    3|  0  1   2   12    22    122     222     1222      2222      12222
    4|  0  1   2    3    13     23      33      133       233        333
    5|  0  1   2    3     4     14      24       34        44        144
    6|  0  1   2    3     4      5      15       25        35         45
    7|  0  1   2    3     4      5       6       16        26         36
    8|  0  1   2    3     4      5       6        7        17         27
    9|  0  1   2    3     4      5       6        7         8         18
   10|  0  1   2    3     4      5       6        7         8          9
		

Programs

  • PARI
    A(n,k) = { (1+k%(n-1))*n^(k\(n-1))-1 }
    
  • Python
    def A(n,k): return (1+(k % (n-1)))*n**(k//(n-1))-1

Formula

A(2, k) = 2^k - 1.
A(3, k) = A062318(k+1).
A(4, k) = A180516(k+1).
A(5, k) = A181287(k+1).
A(6, k) = A181288(k+1).
A(7, k) = A181303(k+1).
A(8, k) = A165804(k+1).
A(9, k) = A140576(k+1).
A(10, k) = A051885(k).
A(n, 0) = 0.
A(n, 1) = 1.
A(n, k) = k iff k < n.
A(n, n) = 2*n - 1.
A(n, n+1) = 3*n - 1 for any n > 2.
Previous Showing 11-20 of 22 results. Next