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

A178746 Binary counter with intermittent bits. Starting at zero the counter attempts to increment by 1 at each step but each bit in the counter alternately accepts and rejects requests to toggle.

Original entry on oeis.org

0, 1, 3, 6, 6, 7, 13, 12, 12, 13, 15, 26, 26, 27, 25, 24, 24, 25, 27, 30, 30, 31, 53, 52, 52, 53, 55, 50, 50, 51, 49, 48, 48, 49, 51, 54, 54, 55, 61, 60, 60, 61, 63, 106, 106, 107, 105, 104
Offset: 0

Views

Author

David Scambler, Jun 08 2010

Keywords

Comments

A simple scatter plot reveals a self-similar structure that resembles flying geese.
Ignoring the initial zero term, split the sequence into rows of increasing binary magnitude such that the terms in row m satisfy 2^m <= a(n) < 2^(m+1).
0: 1,
1: 3,
2: 6,6,7,
3: 13,12,12,13,15,
4: 26,26,27,25,24,24,25,27,30,30,31,
5: 53,52,52,53,55,50,50,51,49,48,48,49,51,54,54,55,61,60,60,61,63,
Then,
Row m starts at n = A005578(m+1) in the original sequence
The first term in row m is A081254(m)
The last term in row m is 2^(m+1)-1
The number of terms in row m is A001045(m+1)
The number of distinct terms in row m is A005578(m)
The number of ascending runs in row m is A005578(m)
The number of non-ascending runs in row m is A005578(m)
The number of descending runs in row m is A052950(m)
The number of non-descending runs in row m is A005578(m-1)
The sum of terms in row m is A178747(m)
The total number of '1' bits in the terms of row n is A178748(m)

Examples

			0 -> low bit toggles -> 1 -> should be 2 but low bit does not toggle -> 3 -> should be 4 but 2nd-lowest bit does not toggle -> 6 -> should be 7 but low bit does not toggle -> 6 -> low bit toggles -> 7
		

Crossrefs

Cf. A178747 sum of terms in rows of a(n), A178748 total number of '1' bits in the terms of rows of a(n).

Programs

  • PARI
    seq(n)={my(a=vector(n+1), f=0, p=0); for(i=2, #a, my(b=bitxor(p+1,p)); f=bitxor(f,b); p=bitxor(p, bitand(b,f)); a[i]=p); a} \\ Andrew Howroyd, Mar 03 2020

Formula

If n is a power of 2, a(n) = n*3/2. Lim(a(n)/n) = 3/2.

A178748 Total number of '1' bits in the terms of 'rows' of A178746.

Original entry on oeis.org

1, 2, 7, 14, 37, 80, 187, 410, 913, 1988, 4327, 9326, 20029, 42776, 91027, 192962, 407785, 859244, 1805887, 3786518, 7922581, 16544192, 34486507, 71769194, 149130817, 309446420, 641262487, 1327264190, 2744006893, 5666970728, 11691855427, 24099538706, 49630733209
Offset: 0

Views

Author

David Scambler, Jun 09 2010

Keywords

Comments

Sum of adjacent terms equals the difference of adjacent terms in A127981. - David Scambler, Jun 10 2010

Examples

			a(0) = bitcount(1) = 1.
a(1) = bitcount(3) = 2.
a(2) = bitcount(6) + bitcount(6) + bitcount(7) = 2 + 2 + 3 = 7.
		

Crossrefs

Cf. A178747 (sum of terms in rows of A178746).
Cf. A127981.

Programs

  • Mathematica
    LinearRecurrence[{2,3,-4,-4},{1,2,7,14},40] (* Harvey P. Dale, Aug 27 2021 *)
  • PARI
    seq(n)={my(a=vector(n+1), f=0, p=0, k=1, s=0); while(k<=#a, my(b=bitxor(p+1,p)); f=bitxor(f,b); p=bitxor(p, bitand(b,f)); if(p>2^k, a[k]=s; k++; s=0); s+=hammingweight(p)); a} \\ Andrew Howroyd, Mar 03 2020
    
  • PARI
    a(n) = {(2^n*(3*n+8) + (3*n+1)*(-1)^n)/9} \\ Andrew Howroyd, Mar 03 2020
    
  • PARI
    Vec((1 - 2*x^3) / ((1 + x)^2*(1 - 2*x)^2) + O(x^30)) \\ Colin Barker, Mar 04 2020

Formula

G.f: (1/2)*x^3 - 1/4 + (x^4 + x^3 - (3/4)*x^2 - (1/2)*x + 1/4)*F(x) = 0. [From GUESSS]
From David Scambler, Jun 10 2010: (Start)
a(n) = (2^n*(3*n+8) + (3*n+1)*(-1)^n)/9.
a(n) + a(n-1) = A127981(n+1) - A127981(n).
(End)
From Colin Barker, Mar 04 2020: (Start)
G.f.: (1 - 2*x^3) / ((1 + x)^2*(1 - 2*x)^2).
a(n) = 2*a(n-1) + 3*a(n-2) - 4*a(n-3) - 4*a(n-4) for n>3.
(End)

Extensions

Terms a(16) and beyond from Andrew Howroyd, Mar 03 2020
Showing 1-2 of 2 results.