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-4 of 4 results.

A053829 Sum of digits of (n written in base 8).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8, 2, 3, 4, 5, 6, 7, 8, 9, 3, 4, 5, 6, 7, 8, 9, 10, 4, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 12, 6, 7, 8, 9, 10, 11, 12, 13, 7, 8, 9, 10, 11, 12, 13, 14, 1, 2, 3, 4, 5, 6, 7, 8, 2, 3, 4, 5, 6, 7, 8, 9, 3, 4, 5, 6, 7, 8, 9, 10, 4, 5, 6, 7, 8, 9, 10
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}, 1->{1,2,3,4,5,6,7,8}, 2->{2,3,4,5,6,7,8,9}, etc. - Robert G. Wilson v, Jul 27 2006

Examples

			a(20)=2+4=6 because 20 is written as 24 base 8.
From _Omar E. Pol_, Feb 21 2010: (Start)
It appears that this can be written as a triangle (See the conjecture in the entry A000120):
0,
1,2,3,4,5,6,7,
1,2,3,4,5,6,7,8,2,3,4,5,6,7,8,9,3,4,5,6,7,8,9,10,4,5,6,7,8,9,10,11,5,6,7,8,9,10,11,12,6,7,8,9,10,11,12,13,7,8,9,10,11,12,13,14,
1,2,3,4,5,6,7,8,2,3,4,5,6,7,8,9,3,4,5,6,7,8,9,10,4,5,6,7,8,9,10...
where the rows converge to A173528. (End)
		

Crossrefs

Programs

  • Haskell
    a053829 n = q 0 $ divMod n 8 where
       q r (0, d) = r + d
       q r (m, d) = q (r + d) $ divMod m 8
    -- Reinhard Zumkeller, May 15 2011
    
  • Mathematica
    Table[Plus @@ IntegerDigits[n, 8], {n, 0, 95}] (* or *)
    Nest[ Flatten[ #1 /. a_Integer -> Table[a + i, {i, 0, 7}]] &, {0}, 4] (* Robert G. Wilson v, Jul 27 2006 *)
  • PARI
    a(n)=if(n<1,0,if(n%8,a(n-1)+1,a(n/8)))
    
  • PARI
    a(n) = sumdigits(n, 8); \\ Michel Marcus, Jul 10 2022
    
  • Python
    def A053829(n): return sum(int(d) for d in oct(n)[2:]) # Chai Wah Wu, Jul 09 2022

Formula

From Benoit Cloitre, Dec 19 2002: (Start)
a(0) = 0, a(8n+i) = a(n)+i for 0 <= i <= 7.
a(n) = n-7*(Sum_{k>0} floor(n/8^k)) = n-7*A054897(n). (End)
a(n) = A138530(n,8) for n > 7. - Reinhard Zumkeller, Mar 26 2008
a(n) = Sum_k>=0 {A031045(n,k)}. - Philippe Deléham, Oct 21 2011
a(0) = 0; a(n) = a(n - 8^floor(log_8(n))) + 1. - Ilya Gutkovskiy, Aug 24 2019
Sum_{n>=1} a(n)/(n*(n+1)) = 8*log(8)/7 (Shallit, 1984). - Amiram Eldar, Jun 03 2021

A090623 Triangle of T(n,k) = [n/k] + [n/k^2] + [n/k^3] + [n/k^4] + ... for n, k > 1.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Dec 06 2003

Keywords

Examples

			Rows start:
  1;
  1,1;
  3,1,1;
  3,1,1,1;
  4,2,1,1,1;
  4,2,1,1,1,1;
  7,2,2,1,1,1,1;
  7,4,2,1,1,1,1,1;
  8,4,2,2,1,1,1,1,1;
  ...
		

Crossrefs

Programs

  • Mathematica
    A090623[n_, k_] := Quotient[n - DigitSum[n, k], k - 1];
    Table[A090623[n, k], {n, 2, 15}, {k, 2, n}] (* Paolo Xausa, Sep 02 2025 *)
  • PARI
    T(n,k) = {my(s = 0, j = 1); while(p=n\k^j, s += p; j++); s;} \\ Michel Marcus, Feb 02 2016
    
  • PARI
    T(n,k) = (n - sumdigits(n,k))/(k-1) \\ Zhuorui He, Aug 25 2025

Formula

For p prime, T(n, p) = A090622(n, p) is the number of times that p is a factor of n!.
T(n,k) = (n - A240236(n, k))/(k - 1). - Zhuorui He, Aug 25 2025

Extensions

a(41) onward corrected by Zhuorui He, Aug 25 2025

A054900 a(n) = Sum_{j >= 1} floor(n/16^j).

Original entry on oeis.org

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

Views

Author

Henry Bottomley, May 23 2000

Keywords

Crossrefs

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

Programs

  • Magma
    m:=16;
    function a(n) // a = A054900, m = 16
      if n eq 0 then return 0;
      else return a(Floor(n/m)) + Floor(n/m);
      end if; end function;
    [a(n): n in [0..127]]; // G. C. Greubel, Apr 28 2023
    
  • Mathematica
    a[n_, m_]:= If[n==0, 0, a[Floor[n/m], m] +Floor[n/m]];
    Table[a[n, 16], {n,0,127}] (* G. C. Greubel, Apr 28 2023 *)
  • SageMath
    m=16 # a = A054900
    def a(n): return 0 if (n==0) else a(n//m) + (n//m)
    [a(n) for n in range(128)] # G. C. Greubel, Apr 28 2023

Formula

a(n) = (n - A053836(n))/15.
From Hieronymus Fischer, Aug 14 2007: (Start)
Recurrence:
a(n) = a(floor(n/16)) + floor(n/16).
a(16*n) = a(n) + n.
a(n*16^m) = a(n) + n*(16^m - 1)/15.
a(k*16^m) = k*(16^m - 1)/15, for 0 <= k < 16, m>=0.
Asymptotic behavior:
a(n) = n/15 + O(log(n)).
a(n+1) - a(n) = O(log(n)) (this follows from the inequalities below).
a(n) <= (n-1)/15; equality holds for powers of 16.
a(n) >= (n-15)/15 - floor(log_16(n)); equality holds for n = 16^m - 1, m > 0.
Limits:
lim inf (n/15 - a(n)) = 1/15, for n --> oo.
lim sup (n/15 - log_16(n) - a(n)) = 0, for n --> oo.
lim sup (a(n+1) - a(n) - log_16(n)) = 0, for n --> oo.
Series:
G.f.: (1/(1-x))*Sum_{k > 0} x^(16^k)/(1-x^(16^k)). (End)

A381886 Triangle read by rows: T(n, k) = Sum_{j=1..floor(log[k](n))} floor(n / k^j) if k >= 2, T(n, 1) = n, T(n, 0) = 0^n.

Original entry on oeis.org

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

Views

Author

Peter Luschny, Apr 03 2025

Keywords

Examples

			Triangle starts:
  [ 0] 1;
  [ 1] 0,  1;
  [ 2] 0,  2,  1;
  [ 3] 0,  3,  1, 1;
  [ 4] 0,  4,  3, 1, 1;
  [ 5] 0,  5,  3, 1, 1, 1;
  [ 6] 0,  6,  4, 2, 1, 1, 1;
  [ 7] 0,  7,  4, 2, 1, 1, 1, 1;
  [ 8] 0,  8,  7, 2, 2, 1, 1, 1, 1;
  [ 9] 0,  9,  7, 4, 2, 1, 1, 1, 1, 1;
  [10] 0, 10,  8, 4, 2, 2, 1, 1, 1, 1, 1;
  [11] 0, 11,  8, 4, 2, 2, 1, 1, 1, 1, 1, 1;
  [12] 0, 12, 10, 5, 3, 2, 2, 1, 1, 1, 1, 1, 1;
		

Crossrefs

Cf. A011371 (column 2), A054861 (column 3), A054893 (column 4), A027868 (column 5), A054895 (column 6), A054896 (column 7), A054897 (column 8), A054898 (column 9), A078651 (row sums).

Programs

  • Maple
    T := (n, b) -> local i; ifelse(b = 0, b^n, ifelse(b = 1, n, add(iquo(n, b^i), i = 1..floor(log(n, b))))): seq(seq(T(n, b), b = 0..n), n = 0..12);
    # Alternative:
    T := (n, k) -> local j; ifelse(k = 0, k^n, ifelse(k = 1, n, add(padic:-ordp(j, k), j = 1..n))): for n from 0 to 12 do seq(T(n, k), k = 0..n) od;
  • Mathematica
    T[n_, 0] := If[n == 0, 1, 0]; T[n_, 1] := n;
    T[n_, k_] := Last@Accumulate[IntegerExponent[Range[n], k]];
    Table[T[n, k], {n, 0, 12}, {k, 0, n}] // MatrixForm
    (* Alternative: *)
    T[n_, k_] := Sum[Floor[n/k^j], {j, Floor[Log[k, n]]}]; T[n_, 1] := n; T[n_, 0] := 0^n; T[0, 0] = 1; Flatten@ Table[T[n, k], {n, 0, 12}, {k, 0, n}] (* Michael De Vlieger, Apr 03 2025 *)
  • PARI
    T(n,k) = if (n==0, 1, if (n==1, k, if (k==0, 0, if (k==1, n, sum(j=1, n, valuation(j, k))))));
    row(n) = vector(n+1, k, T(n,k-1)); \\ Michel Marcus, Apr 04 2025
  • Python
    from math import log
    def T(n: int, b: int) -> int:
        return (b**n if b == 0 else n if b == 1 else
            sum(n // (b**i) for i in range(1, 1 + int(log(n, b)))))
    print([[T(n, b) for b in range(n+1)] for n in range(12)])
    
  • SageMath
    def T(n, b): return (b^n if b == 0 else n if b == 1 else sum(valuation(j, b) for j in (1..n)))
    print(flatten([[T(n, b) for b in range(n+1)] for n in srange(13)]))
    

Formula

T(n, k) = Sum_{j=1..n} valuation(j, k) for n >= 2.
Showing 1-4 of 4 results.