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

A138530 Triangle read by rows: T(n,k) = sum of digits of n in base k representation, 1<=k<=n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Mar 26 2008

Keywords

Comments

A131383(n) = sum of n-th row;
A000027(n) = T(n,1);
A000120(n) = T(n,2) for n>1;
A053735(n) = T(n,3) for n>2;
A053737(n) = T(n,4) for n>3;
A053824(n) = T(n,5) for n>4;
A053827(n) = T(n,6) for n>5;
A053828(n) = T(n,7) for n>6;
A053829(n) = T(n,8) for n>7;
A053830(n) = T(n,9) for n>8;
A007953(n) = T(n,10) for n>9;
A053831(n) = T(n,11) for n>10;
A053832(n) = T(n,12) for n>11;
A053833(n) = T(n,13) for n>12;
A053834(n) = T(n,14) for n>13;
A053835(n) = T(n,15) for n>14;
A053836(n) = T(n,16) for n>15;
A007395(n) = T(n,n-1) for n>1;
A000012(n) = T(n,n).

Examples

			Start of the triangle for n in base k representation:
......................1
....................11....10
......... ........111....11...10
................1111...100...11..10
..............11111...101...12..11..10
............111111...110...20..12..11..10
..........1111111...111...21..13..12..11..10
........11111111..1000...22..20..13..12..11..10
......111111111..1001..100..21..14..13..12..11..10
....1111111111..1010..101..22..20..14..13..12..11..10
..11111111111..1011..102..23..21..15..14..13..12..11..10
111111111111..1100..110..30..22..20..15..14..13..12..11..10,
and the triangle of sums of digits starts:
......................1
.....................2...1
......... ..........3...2...1
...................4...1...2...1
..................5...2...3...2...1
.................6...2...2...3...2...1
................7...3...3...4...3...2...1
...............8...1...4...2...4...3...2...1
..............9...2...1...3...5...4...3...2...1
............10...2...2...4...2...5...4...3...2...1
...........11...3...3...5...3...6...5...4...3...2...1
..........12...2...2...3...4...2...6...5...4...3...2...1.
		

Crossrefs

Cf. A007953. See A240236 for another version.
Cf. A002260.

Programs

  • Haskell
    a138530 n k = a138530_tabl !! (n-1) !! (k-1)
    a138530_row n = a138530_tabl !! (n-1)
    a138530_tabl = zipWith (map . flip q) [1..] a002260_tabl where
       q 1 n = n
       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
    T[n_, k_] := If[k == 1, n, Total[IntegerDigits[n, k]]];
    Table[T[n, k], {n, 1, 14}, {k, 1, n}] // Flatten (* Jean-François Alcover, Oct 25 2021 *)

A037314 Numbers whose base-3 and base-9 expansions have the same digit sum.

Original entry on oeis.org

0, 1, 2, 9, 10, 11, 18, 19, 20, 81, 82, 83, 90, 91, 92, 99, 100, 101, 162, 163, 164, 171, 172, 173, 180, 181, 182, 729, 730, 731, 738, 739, 740, 747, 748, 749, 810, 811, 812, 819, 820, 821, 828, 829, 830, 891, 892, 893, 900, 901, 902, 909, 910, 911
Offset: 0

Views

Author

Keywords

Comments

a(n) = Sum_{i=0..m} d(i)*9^i, where Sum_{i=0..m} d(i)*3^i is the base-3 representation of n.
Numbers that can be written using only digits 0, 1 and 2 in base 9. Also, write n in base 3, read as base 9: (3) [n] (9) in base change notation. a(3n+k) = 9a(n)+k for k in {0,1,2}. - Franklin T. Adams-Watters, Jul 24 2006
Also, every term k corresponds to a unique pair i,j with k = a(i) + 3*a(j) (similarly to the Moser-de Bruijn sequence). - Luis Rato, May 02 2024

Crossrefs

Cf. A007089, A208665, A338086 (ternary digit duplication).

Programs

  • Julia
    function a(n)
        m, r, b = n, 0, 1
        while m > 0
            m, q = divrem(m, 3)
            r += b * q
            b *= 9
        end
    r end
    [a(n) for n in 0:53] |> println # Peter Luschny, Jan 03 2021
  • Mathematica
    Table[FromDigits[RealDigits[n, 3], 9], {n, 1, 100}] (* Clark Kimberling, Aug 14 2012 *)
    Select[Range[0,1000],Total[IntegerDigits[#,3]]==Total[IntegerDigits[#,9]]&] (* Harvey P. Dale, Feb 17 2020 *)
  • PARI
    a(n) = {my(d = digits(n, 3)); subst(Pol(d), x, 9);} \\ Michel Marcus, Apr 09 2015
    

Formula

G.f. f(x) = Sum_{j>=0} 9^j*x^(3^j)*(1+x^(3^j)-2*x^(2*3^j))/((1-x)*(1-x^(3^(j+1)))) satisfies f(x) = 9*(x^2+x+1)*f(x^3) + x*(1+2*x)/(1-x^3). - Robert Israel, Apr 13 2015

Extensions

Edited by N. J. A. Sloane at the suggestion of Andrew S. Plewe, Jun 08 2007
Offset changed to 0 by Clark Kimberling, Aug 14 2012

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

A053844 (Sum of digits of n written in base 9) modulo 9.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Mar 28 2000

Keywords

Crossrefs

Eighth row of the array in A141803.

Programs

  • Mathematica
    Mod[DigitSum[Range[0, 100], 9], 9] (* Paolo Xausa, Aug 09 2024 *)

Formula

a(n) = A010878(A053830(n)). - Paolo Xausa, Aug 09 2024

A173525 a(n) = 1 + A053824(n-1), where A053824 = sum of digits in base 5.

Original entry on oeis.org

1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, 4, 5, 6, 7, 4, 5, 6, 7, 8, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 3, 4, 5, 6, 7, 4, 5, 6, 7, 8, 5, 6, 7, 8, 9, 6, 7, 8, 9, 10, 3, 4, 5, 6, 7, 4, 5, 6, 7, 8, 5, 6, 7, 8, 9, 6, 7, 8, 9, 10, 7, 8, 9, 10, 11, 4, 5, 6, 7, 8, 5, 6, 7, 8, 9, 6, 7, 8, 9, 10, 7, 8, 9, 10, 11, 8, 9, 10, 11, 12
Offset: 1

Views

Author

Omar E. Pol, Feb 20 2010

Keywords

Comments

Also: a(n) = A053824(5^k+n-1) in the limit k->infinity, where k plays the role of a row index in A053824. (See the comment by M. F. Hasler for the proof.)
This means: if A053824 is regarded as a triangle then the rows converge to this sequence.
See conjecture in the entry A000120, and the case of base 2 in A063787.
From R. J. Mathar, Dec 09 2010: (Start)
In base b=5, A053824 starts counting up from 1 each time the index wraps around a power of b: A053824(b^k)=1.
Obvious recurrences are A053824(m*b^k+i) = m+A053824(i), 1 <= m < b-1, 0 <= i < b^(k-1).
So A053824 can be decomposed into a triangle T(k,n) = A053824(b^k+n-1), assuming that column indices start at n=1; row lengths are (b-1)*b^k.
There is a self-similarity in these sequences; a sawtooth structure of periodicity b is added algebraically on top of a sawtooth structure of periodicity b^2, on top of a periodicity b^3 etc. This leads to some "fake" finitely periodic substructures in the early parts of each row of T(.,.): often, but not always, a(n+b)=1+a(n). Often, but not always, a(n+b^2)=1+a(n) etc.
The common part of the rows T(.,.) grows with the power of b as shown in the recurrence above, and defines a(n) in the limit of large row indices k. (End)
The two definitions agree because the first 5^r terms in each row correspond to numbers 5^r, 5^r+1,...,5^r+(5^r-1), which are written in base 5 as a leading 1 plus the digits of 0,...,5^r-1. - M. F. Hasler, Dec 09 2010
From Omar E. Pol, Dec 10 2010: (Start)
In the scatter plots of these sequences, the basic structure is an element with b^2 points, where b is the associated base. (Scatter plots are created with the "graph" button of a sequence.) Sketches of these structures look as follows, the horizontal axis a squeezed version of the index n, b consecutive points packed vertically, and the vertical axis a(n):
........................................................
................................................ * .....
............................................... ** .....
..................................... * ...... *** .....
.................................... ** ..... **** .....
.......................... * ...... *** .... ***** .....
......................... ** ..... **** ... ****** .....
............... * ...... *** .... ***** ... ***** ......
.............. ** ..... **** .... **** .... **** .......
.... * ...... *** ..... *** ..... *** ..... *** ........
... ** ...... ** ...... ** ...... ** ...... ** .........
... * ....... * ....... * ....... * ....... * ..........
........................................................
... b=2 ..... b=3 ..... b=4 ..... b=5 ..... b=6 ........
........................................................
............................................. * ........
............................................ ** ........
........................... * ............. *** ........
.......................... ** ............ **** ........
........... *............ *** ........... ***** ........
.......... ** .......... **** .......... ****** ........
......... ***.......... ***** ......... ******* ........
........ **** ........ ****** ........ ******** ........
....... ***** ....... ******* ....... ********* ........
...... ****** ...... ******** ....... ******** .........
..... ******* ...... ******* ........ ******* ..........
..... ****** ....... ****** ......... ****** ...........
..... ***** ........ ***** .......... ***** ............
..... **** ......... **** ........... **** .............
..... *** .......... *** ............ *** ..............
..... ** ........... ** ............. ** ...............
..... * ............ * .............. * ................
........................................................
..... b=7 .......... b=8 ............ b=9 ..............
... A053828 ...... A053829 ........ A053830 ............
... A173527 ...... A173528 ........ A173529 ............(End)

Crossrefs

Programs

  • Haskell
    a173525 = (+ 1) . a053824 . (subtract 1) -- Reinhard Zumkeller, Jan 31 2014
  • Maple
    A053825 := proc(n) add(d, d=convert(n,base,5)) ; end proc:
    A173525 := proc(n) local b,k; b := 5 ; if n < b then n; else k := n/(b-1);   k := ceil(log(k)/log(b)) ; A053825(b^k+n-1) ; end if; end proc:
    seq(A173525(n),n=1..100) ;
  • Mathematica
    Total[IntegerDigits[#,5]]+1&/@Range[0,100] (* Harvey P. Dale, Jun 14 2015 *)
  • PARI
    A173525(n)={ my(s=1); n--; until(!n\=5, s+=n%5); s } \\ M. F. Hasler, Dec 09 2010
    
  • PARI
    A173525(n)={ my(s=1+(n=divrem(n-1,5))[2]); while((n=divrem(n[1],5))[1],s+=n[2]); s+n[2] } \\ M. F. Hasler, Dec 09 2010
    

Formula

a(n) = A053824(5^k + n - 1) where k >= ceiling(log_5(n/4)). - R. J. Mathar, Dec 09 2010

Extensions

More terms from Vincenzo Librandi, Aug 02 2010

A054898 a(n) = Sum_{k>0} floor(n/9^k).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11
Offset: 0

Views

Author

Henry Bottomley, May 23 2000

Keywords

Comments

Different from the highest power of 9 dividing n!, A090618.

Examples

			a(100)=12.
a(10^3)=124.
a(10^4)=1248.
a(10^5)=12498.
a(10^6)=124996.
a(10^7)=1249997.
a(10^8)=12499996.
a(10^9)=124999997.
		

Crossrefs

Cf. A011371 and A054861 for analogs involving powers of 2 and 3.

Programs

  • Mathematica
    Table[t = 0; p = 9; While[s = Floor[n/p]; t = t + s; s > 0, p *= 9]; t, {n, 0, 100} ]
    Table[Sum[Floor[n/9^k],{k,n}],{n,0,100}] (* Harvey P. Dale, Jul 10 2024 *)

Formula

a(n) = floor(n/9) + floor(n/81) + floor(n/729) + floor(n/6561) + ....
a(n) = (n-A053830(n))/8.
From Hieronymus Fischer, Aug 14 2007: (Start)
Recurrence:
a(n) = floor(n/9) + a(floor(n/9));
a(9*n) = n + a(n);
a(n*9^m) = n*(9^m-1)/8 + a(n).
a(k*9^m) = k*(9^m-1)/8, for 0<=k<9, m>=0.
Asymptotic behavior:
a(n) = n/8 + O(log(n)),
a(n+1) - a(n) = O(log(n)); this follows from the inequalities below.
a(n) <= (n-1)/8; equality holds for powers of 9.
a(n) >= (n-8)/8 - floor(log_9(n)); equality holds for n=9^m-1, m>0.
lim inf (n/8 - a(n)) =1/8, for n-->oo.
lim sup (n/8 - log_9(n) - a(n)) = 0, for n-->oo.
lim sup (a(n+1) - a(n) - log_9(n)) = 0, for n-->oo.
G.f.: g(x) = sum{k>0, x^(9^k)/(1-x^(9^k))}/(1-x). (End)

Extensions

Examples added by Hieronymus Fischer, Jun 06 2012

A216789 Table read by antidiagonals: T(n,k) is the digital sum of k in base n displayed in decimal.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

T(n,k) is the least number of powers of n that add up to k. - Mohammed Yaseen, Nov 12 2022

Examples

			A000120   0, 1, 1, 2, 1, 2, 2, 3, 1, 2,  2,  3,  2,  3,  3,  4, 1, 2, 2
A053735   0, 1, 2, 1, 2, 3, 2, 3, 4, 1,  2,  3,  2,  3,  4,  3, 4, 5, 2
A053737   0, 1, 2, 3, 1, 2, 3, 4, 2, 3,  4,  5,  3,  4,  5,  6, 1, 2, 3
A053824   0, 1, 2, 3, 4, 1, 2, 3, 4, 5,  2,  3,  4,  5,  6,  3, 4, 5, 6
A053827   0, 1, 2, 3, 4, 5, 1, 2, 3, 4,  5,  6,  2,  3,  4,  5, 6, 7, 3
A053828   0, 1, 2, 3, 4, 5, 6, 1, 2, 3,  4,  5,  6,  7,  2,  3, 4, 5, 6
A053829   0, 1, 2, 3, 4, 5, 6, 7, 1, 2,  3,  4,  5,  6,  7,  8, 2, 3, 4
A053830   0, 1, 2, 3, 4, 5, 6, 7, 8, 1,  2,  3,  4,  5,  6,  7, 8, 9, 2
A007953   0, 1, 2, 3, 4, 5, 6, 7, 8, 9,  1,  2,  3,  4,  5,  6, 7, 8, 9
A053831   0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,  1,  2,  3,  4,  5, 6, 7, 8
A053832   0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,  1,  2,  3,  4, 5, 6, 7
A053833   0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,  1,  2,  3, 4, 5, 6
A053834   0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,  1,  2, 3, 4, 5
A053835   0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,  1, 2, 3, 4
A053836   0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3
		

Crossrefs

Programs

  • Maple
    [seq(seq(convert(convert(n-b,base,b),`+`),b=n..2,-1),n=1..15)]; # Robert Israel, Aug 02 2020
  • Mathematica
    DigitSum[n_, b_: 10] := Total[IntegerDigits[n, b]]; Table[ DigitSum[n - b, b], {n, 2, 13}, {b, n, 2, -1}] // Flatten

Extensions

Name and offset corrected by Mohammed Yaseen, Nov 12 2022

A309788 Product of digits of (n written in base 9).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 2, 4, 6, 8, 10, 12, 14, 16, 0, 3, 6, 9, 12, 15, 18, 21, 24, 0, 4, 8, 12, 16, 20, 24, 28, 32, 0, 5, 10, 15, 20, 25, 30, 35, 40, 0, 6, 12, 18, 24, 30, 36, 42, 48, 0, 7, 14, 21, 28, 35, 42, 49, 56, 0, 8, 16, 24, 32, 40, 48, 56, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 2
Offset: 0

Views

Author

Ilya Gutkovskiy, Aug 26 2019

Keywords

Crossrefs

Product of digits of (n written in base k): A309953 (k = 3), A309954 (k = 4), A309956 (k = 5), A309957 (k = 6), A309958 (k = 7), A309959 (k = 8), this sequence (k = 9), A007954 (k = 10).

Programs

  • Magma
    [0] cat [&*Intseq(n,9):n in [1..100]]; // Marius A. Burtea, Aug 26 2019
  • Mathematica
    Table[Times @@ IntegerDigits[n, 9], {n, 0, 100}]

Formula

G.f. A(x) satisfies: A(x) = x * (1 + 2*x + 3*x^2 + 4*x^3 + 5*x^4 + 6*x^5 + 7*x^6 + 8*x^7) * (1 + A(x^9)).

A346732 Replace 9^k with (-1)^k in base-9 expansion of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, -1, 0, 1, 2, 3, 4, 5, 6, 7, -2, -1, 0, 1, 2, 3, 4, 5, 6, -3, -2, -1, 0, 1, 2, 3, 4, 5, -4, -3, -2, -1, 0, 1, 2, 3, 4, -5, -4, -3, -2, -1, 0, 1, 2, 3, -6, -5, -4, -3, -2, -1, 0, 1, 2, -7, -6, -5, -4, -3, -2, -1, 0, 1, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, -1, 0, 1, 2, 3, 4
Offset: 0

Views

Author

Ilya Gutkovskiy, Jul 30 2021

Keywords

Comments

If n has base-9 expansion abc..xyz with least significant digit z, a(n) = z - y + x - w + ...

Examples

			89 = 108_9, 8 - 0 + 1 = 9, so a(89) = 9.
		

Crossrefs

Programs

  • Mathematica
    nmax = 104; A[] = 0; Do[A[x] = x (1 + 2 x + 3 x^2 + 4 x^3 + 5 x^4 + 6 x^5 + 7 x^6 + 8 x^7)/(1 - x^9) - (1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8) A[x^9] + O[x]^(nmax + 1) // Normal, nmax + 1]; CoefficientList[A[x], x]
    Table[n + 10 Sum[(-1)^k Floor[n/9^k], {k, 1, Floor[Log[9, n]]}], {n, 0, 104}]
  • Python
    from sympy.ntheory.digits import digits
    def a(n):
        return sum(bi*(-1)**k for k, bi in enumerate(digits(n, 9)[1:][::-1]))
    print([a(n) for n in range(105)]) # Michael S. Branicky, Jul 31 2021

Formula

G.f. A(x) satisfies: A(x) = x * (1 + 2*x + 3*x^2 + 4*x^3 + 5*x^4 + 6*x^5 + 7*x^6 + 8*x^7) / (1 - x^9) - (1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8) * A(x^9).
a(n) = n + 10 * Sum_{k>=1} (-1)^k * floor(n/9^k).

A245338 Sum of digits of n written in fractional base 9/8.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10, 11, 12, 13, 14, 15, 16, 15, 16, 17, 18, 19, 20, 21, 22, 23, 21, 22, 23, 24, 25, 26, 27, 28, 29, 26, 27, 28, 29, 30, 31, 32, 33, 34, 30, 31, 32, 33, 34, 35, 36, 37, 38, 33, 34, 35, 36, 37, 38, 39, 40, 41, 35, 36, 37, 38, 39
Offset: 0

Views

Author

Tom Edgar, Jul 18 2014

Keywords

Comments

The base 9/8 expansion is unique and thus the sum of digits function is well-defined.

Examples

			In base 9/8 the number 16 is represented by 87 and so a(16) = 8 + 7 = 15.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = If[n == 0, 0, a[8 * Floor[n/9]] + Mod[n, 9]]; Array[a, 100, 0] (* Amiram Eldar, Aug 04 2025 *)
  • PARI
    a(n) = if(n == 0, 0, a(n\9 * 8) + n % 9); \\ Amiram Eldar, Aug 04 2025
  • Sage
    # uses [basepqsum from A245355]
    [basepqsum(9,8,i) for i in [0..100]]
    

Formula

a(n) = A007953(A024656(n)).
Previous Showing 11-20 of 26 results. Next