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.

A080277 Partial sums of A038712.

Original entry on oeis.org

1, 4, 5, 12, 13, 16, 17, 32, 33, 36, 37, 44, 45, 48, 49, 80, 81, 84, 85, 92, 93, 96, 97, 112, 113, 116, 117, 124, 125, 128, 129, 192, 193, 196, 197, 204, 205, 208, 209, 224, 225, 228, 229, 236, 237, 240, 241, 272, 273, 276, 277, 284, 285, 288, 289, 304, 305, 308
Offset: 1

Views

Author

N. J. A. Sloane, Mar 19 2003

Keywords

Examples

			From _Omar E. Pol_, Sep 10 2019: (Start)
Illustration of initial terms:
a(n) is also the total area (or the total number of cells) in first n regions of an infinite diagram of compositions (ordered partitions) of the positive integers, where the length of the n-th horizontal line segment is equal to A001511(n), the length of the n-th vertical line segment is equal to A006519(n), and area of the n-th region is equal to A038712(n), as shown below (first eight regions):
-----------------------------------
n  A038712(n)  a(n)       Diagram
-----------------------------------
.                         _ _ _ _
1      1         1       |_| | | |
2      3         4       |_ _| | |
3      1         5       |_|   | |
4      7        12       |_ _ _| |
5      1        13       |_| |   |
6      3        16       |_ _|   |
7      1        17       |_|     |
8     15        32       |_ _ _ _|
.
The above diagram represents the eight compositions of 4: [1,1,1,1],[2,1,1],[1,2,1],[3,1],[1,1,2],[2,2],[1,3],[4].
(End)
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember;
          `if`(n=0, 0, a(n-1)+Bits[Xor](n, n-1))
        end:
    seq(a(n), n=1..58);  # Alois P. Heinz, Feb 14 2023
  • Mathematica
    Table[BitXor[n, n-1], {n, 1, 58}] // Accumulate (* Jean-François Alcover, Oct 24 2013 *)
  • PARI
    a(n) = fromdigits(Vec(Pol(binary(n<<1))'),2); \\ Kevin Ryde, Apr 29 2021

Formula

a(n) is conjectured to be asymptotic to n*log(n)/log(2). - Klaus Brockhaus, Mar 23 2003 [See Bannister et al., 2013. - N. J. A. Sloane, Nov 26 2013]
a(n) = Sum_{k=0..log_2(n)} 2^k*floor(n/2^k).
a(2^k) = (k+1)*2^k.
a(n) = n + 2*a(floor(n/2)). - Vladeta Jovovic, Aug 06 2003
From Ralf Stephan, Sep 07 2003: (Start)
a(1) = 1, a(2*n) = 2*a(n) + 2*n, a(2*n+1) = 2*a(n) + 2*n + 1.
G.f.: 1/(1-x) * Sum(k >= 0, 2^k*t/(1-t), t = x^2^k). (End)
Product_{n >= 1} (1 + x^(n*2^(n-1))) = (1 + x)*(1 + x^4)*(1 + x^12)*(1 + x^32)*... = 1 + Sum_{n >= 1} x^a(n) = 1 + x + x^4 + x^5 + x^12 + x^13 + .... Hence this sequence lists the numbers representable as a sum of distinct elements of A001787 = [1, 4, 12, ..., n*2^(n-1), ...]. Cf. A050292. See also A120385. - Peter Bala, Feb 02 2013
n log_2 n - 2n < a(n) <= n log_2 n + n [Bannister et al., 2013] - David Eppstein, Aug 31 2013
G.f. A(x) satisfies: A(x) = 2*A(x^2)*(1 + x) + x/(1 - x)^2. - Ilya Gutkovskiy, Oct 30 2019
a(n) = A136013(2n). - Pontus von Brömssen, Sep 06 2020

A135481 a(n) = 2^A007814(n+1) - 1.

Original entry on oeis.org

0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 15, 0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 31, 0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 15, 0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 63, 0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 15, 0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 31, 0, 1, 0, 3, 0, 1, 0
Offset: 0

Views

Author

N. J. A. Sloane, based on a message from Guy Steele and Don Knuth, Mar 01 2008

Keywords

Comments

This is Guy Steele's sequence GS(1, 6) (see A135416).

Crossrefs

Cf. A006519, A007814, A135416, A140670, A136013 (partial sums).

Programs

Formula

a(n) = A006519(n+1) - 1. - R. J. Mathar, Feb 10 2016

Extensions

a(0) = 0 prepended by Andrey Zabolotskiy, Oct 08 2019, based on Lothar Esser's contribution

A006520 Partial sums of A006519.

Original entry on oeis.org

1, 3, 4, 8, 9, 11, 12, 20, 21, 23, 24, 28, 29, 31, 32, 48, 49, 51, 52, 56, 57, 59, 60, 68, 69, 71, 72, 76, 77, 79, 80, 112, 113, 115, 116, 120, 121, 123, 124, 132, 133, 135, 136, 140, 141, 143, 144, 160, 161, 163, 164, 168, 169, 171, 172, 180, 181, 183, 184, 188, 189
Offset: 1

Views

Author

Keywords

Comments

The subsequence of primes in this partial sum begins: 3, 11, 23, 29, 31, 59, 71, 79, 113, 163, 181. The subsequence of powers in this partial sum begins: 1, 4, 8, 9, 32, 49, 121, 144, 169. - Jonathan Vos Post, Feb 18 2010

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

First differences of A022560.

Programs

  • Mathematica
    Table[ 2^IntegerExponent[n, 2], {n, 1, 70}] // Accumulate (* Jean-François Alcover, May 14 2013 *)
  • PARI
    a(n)=sum(i=1,n,2^valuation(i,2))
    
  • Python
    def A006520(n): return sum(i&-i for i in range(1,n+1)) # Chai Wah Wu, Jul 14 2022

Formula

a(n)/(n*log(n)) is bounded. - Benoit Cloitre, Dec 17 2002
G.f.: (1/(x*(1-x))) * (x/(1-x) + Sum_{k>=1} 2^(k-1)*x^2^k/(1-x^2^k)). - Ralf Stephan, Apr 17 2003
a(n) = b(n+1), with b(2n) = 2b(n) + n, b(2n+1) = 2b(n) + n + 1. - Ralf Stephan, Sep 07 2003
a(2^k-1) = k*2^(k-1) = A001787(k) for any k > 0. - Rémy Sigrist, Jan 21 2021
a(n) ~ (1/(2*log(2)))*n*log(n) + (3/4 + (gamma-1)/(2*log(2)))*n, where gamma is Euler's constant (A001620). - Amiram Eldar, Nov 15 2022
a(n) = A136013(n) + n = A159699(n) - n. - Alan Michael Gómez Calderón, Apr 13 2025

Extensions

More terms from Benoit Cloitre, Dec 17 2002
Offset changed to 1 by N. J. A. Sloane, Oct 18 2019

A333979 Array read by antidiagonals, n >= 0, k >= 2: T(n,k) is the "digital derivative" of n in base k; if the base k representation of n is Sum_{j>=0} d_j*k^j, then T(n,k) = Sum_{j>=1} d_j*j*k^(j-1).

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, 0, 0, 0, 1, 4, 0, 0, 0, 0, 1, 1, 5, 0, 0, 0, 0, 0, 1, 2, 5, 0, 0, 0, 0, 0, 1, 1, 2, 12, 0, 0, 0, 0, 0, 0, 1, 1, 2, 12, 0, 0, 0, 0, 0, 0, 1, 1, 2, 6, 13, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 6, 13
Offset: 0

Views

Author

Pontus von Brömssen, Sep 04 2020

Keywords

Examples

			Array begins:
  n\k|  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
  ---|---------------------------------------------
   0 |  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
   1 |  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
   2 |  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0
   3 |  1  1  0  0  0  0  0  0  0  0  0  0  0  0  0
   4 |  4  1  1  0  0  0  0  0  0  0  0  0  0  0  0
   5 |  4  1  1  1  0  0  0  0  0  0  0  0  0  0  0
   6 |  5  2  1  1  1  0  0  0  0  0  0  0  0  0  0
   7 |  5  2  1  1  1  1  0  0  0  0  0  0  0  0  0
   8 | 12  2  2  1  1  1  1  0  0  0  0  0  0  0  0
   9 | 12  6  2  1  1  1  1  1  0  0  0  0  0  0  0
  10 | 13  6  2  2  1  1  1  1  1  0  0  0  0  0  0
  11 | 13  6  2  2  1  1  1  1  1  1  0  0  0  0  0
  12 | 16  7  3  2  2  1  1  1  1  1  1  0  0  0  0
  13 | 16  7  3  2  2  1  1  1  1  1  1  1  0  0  0
  14 | 17  7  3  2  2  2  1  1  1  1  1  1  1  0  0
  15 | 17  8  3  3  2  2  1  1  1  1  1  1  1  1  0
  16 | 32  8  8  3  2  2  2  1  1  1  1  1  1  1  1
64 = 2*3^3 + 1*3^2 + 0*3^1 + 1*3^0, so T(64,3) = 2*3*3^2 + 1*2*3^1 + 0*1*3^0 = 60. Alternatively, using the formula T(n,k) = floor(n/k) + k*T(floor(n/k),k), we get T(64,3) = 21 + 3*T(21,3) = 21 + 3*(7 + 3*T(7,3)) = 42 + 9*(2 + 3*T(2,3)) = 60.
		

Crossrefs

Cf. A136013 (column k=2), A080277 (every second term of column k=2), A080333 (every third term of column k=3).

Programs

  • Python
    import sympy
    def A333979(n,k):
      d=sympy.ntheory.factor_.digits(n,k)
      return sum(j*d[-j-1]*k**(j-1) for j in range(1,len(d)-1))
    
  • Python
    # Second program (faster)
    def A333979(n,k):
      return n//k+k*A333979(n//k,k) if n>=k else 0

Formula

T(n,k) = floor(n/k) + k*T(floor(n/k),k). Proof: With n = Sum_{j>=0} d_j*k^j we have floor(n/k) + k*T(floor(n/k),k) = Sum_{j>=1} (d_j*k^(j-1) + k*d_j*(j-1)*k^(j-2)) = Sum_{j>=1} d_j*j*k^(j-1) = T(n,k).
T(n,k) = T(n-1,k) + A055129(A286561(n,k),k). Proof: Let n = Sum_{j>=0} d_j*k^j and pick v so that d_j = 0 for j < v and d_v > 0 (so v = A286561(n,k)). Then n - 1 = sum_{j>=0} e_j*k^j, where e_j = k - 1 for j < v, e_v = d_v - 1, and e_j = d_j for j > v. We get T(n,k) - T(n-1,k) = Sum_{j>=1} j*(d_j-e_j)*k^(j-1) = v*k^(v-1) - (k-1)*Sum_{1<=jA055129(A286561(n,k),k).
For fixed k, T(n,k) ~ n*log(n)/(k*log(k)). (The proof for k = 2 by Bannister et al. (p. 182) can be adapted to general k.)
T(n,k) = Sum_{j>=0} k^j*floor(n/k**(j+1)).

A007824 a(n) = f(a(n-1)), with f(m) = Sum i*b(i)*2^(i-1), m = Sum b(i)*2^i, and starting value 16.

Original entry on oeis.org

16, 32, 80, 224, 720, 2976, 15120, 92448, 704592, 6455520, 69518032, 897158048, 12700875536, 203746961696, 3674124288080, 74060581880032, 1692860294726352, 42020514867170208, 1144626896435067664, 33222330682700081440
Offset: 0

Views

Author

Ralph Buchholz [ ralph(AT)defcen.gov.au ], Leisa Condie

Keywords

Comments

Previous name was : For N=Sum a(i).2^i, a(i)=0,1, set D(N)/D(2)=Sum i.a(i).2^(i-1); sequence gives n-th derivative of 16.
Actually, it appears that f(n) for n=0, 1, 2, ... gives 0, 0, 1, 1, 4, 4, 5, 5, 12, 12, 13, 13, 16, 16, 17, 17, 32, 32, 33, 33, 36, ... that is A136013. - Michel Marcus, Jul 18 2013 [This now follows from the comments in A136013. - Pontus von Brömssen, Sep 06 2020]

Crossrefs

Programs

  • PARI
    D(n) = {b = binary(n); lb = #b; rb = vector(lb, i, b[lb-i+1]); return(sum (i=0, lb-1, i*2^(i-1)*rb[i+1]));}
    lista(nn) = {m = 16; for (n=0, nn, print1(m, ", "); m = D(m););} \\ Michel Marcus, Jul 18 2013

Formula

a(n) = 16*A007823(n). - Pontus von Brömssen, Sep 06 2020

Extensions

Edited by Michel Marcus, Jul 18 2013

A368595 Alternating sum of A006519.

Original entry on oeis.org

-1, 1, 0, 4, 3, 5, 4, 12, 11, 13, 12, 16, 15, 17, 16, 32, 31, 33, 32, 36, 35, 37, 36, 44, 43, 45, 44, 48, 47, 49, 48, 80, 79, 81, 80, 84, 83, 85, 84, 92, 91, 93, 92, 96, 95, 97, 96, 112, 111, 113, 112, 116, 115, 117, 116, 124, 123, 125, 124, 128, 127, 129, 128
Offset: 1

Views

Author

Jeffrey Shallit, Dec 31 2023

Keywords

Comments

a(n) <= (n/2)*log_2 n, with equality at powers of 2.

Crossrefs

Cf. A006519. A006520 (all positive signs), A136013.
Cf. A093347 (with powers of 3).

Programs

  • Mathematica
    a[1]=-1;a[n_]:=If[OddQ[n],a[n-1]-2^IntegerExponent[n,2],a[n-1]+2^IntegerExponent[n,2]];Table[a[n],{n,63}] (* James C. McMahon, Dec 31 2023 *)
  • PARI
    a(n) = fromdigits(Vec(Pol(binary(n))'),2) - bitand(n,1); \\ Kevin Ryde, Jan 01 2024
    
  • Python
    def A368595(n): return sum(map(lambda x:(x[0]+1)*(1<Chai Wah Wu, Jan 01 2024

Formula

a(n) = Sum_{i=1..n} (-1)^i*A006519(i).
a(n) = A136013(n) - (n mod 2). - Kevin Ryde, Jan 01 2024
Showing 1-6 of 6 results.