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

A255056 Trunk of number-of-runs beanstalk: The unique infinite sequence such that a(n-1) = a(n) - number of runs in binary representation of a(n).

Original entry on oeis.org

0, 2, 4, 6, 10, 12, 14, 18, 22, 26, 28, 30, 32, 36, 42, 46, 50, 54, 58, 60, 62, 64, 68, 74, 78, 84, 90, 94, 96, 100, 106, 110, 114, 118, 122, 124, 126, 128, 132, 138, 142, 148, 152, 156, 162, 168, 174, 180, 186, 190, 192, 196, 202, 206, 212, 218, 222, 224, 228, 234, 238, 242, 246, 250, 252, 254
Offset: 0

Views

Author

Antti Karttunen, Feb 14 2015

Keywords

Comments

All numbers of the form (2^n)-2 are present, which guarantees the uniqueness and also provides a well-defined method to compute the sequence, for example, via a partially reversed version A255066.
The sequence was inspired by a similar "binary weight beanstalk", A179016, sharing some general properties with it (like its partly self-copying behavior, see A255071), but also differing in some aspects. For example, here the branching degree is not the constant 2, but can vary from 1 to 4. (Cf. A255058.)

Crossrefs

First differences: A255336.
Terms halved: A255057.
Cf. A255053 & A255055 (the lower & upper bound for a(n)) and also A255123, A255124 (distances to those limits).
Cf. A255327, A255058 (branching degree for node n), A255330 (number of nodes in the finite subtrees branching from the node n), A255331, A255332
Subsequence: A000918 (except for -1).
Similar "beanstalk's trunk" sequences using some other subtracting map than A236840: A179016, A219648, A219666.

Programs

Formula

a(n) = A255066(A255122(n)).
Other identities and observations. For all n >= 0:
a(n) = 2*A255057(n).
A255072(a(n)) = n.
A255053(n) <= a(n) <= A255055(n).

A255071 Number of steps required to reach (2^n)-2 from 2^(n+1)-2 by iterating the map x -> x - (number of runs in binary representation of x).

Original entry on oeis.org

1, 2, 3, 5, 9, 16, 29, 53, 97, 178, 328, 608, 1134, 2126, 4001, 7552, 14292, 27115, 51565, 98274, 187657, 358982, 687944, 1320793, 2540702, 4896919, 9456143, 18291753, 35435799, 68731296, 133436379, 259238717, 503912508, 979923792, 1906297165, 3709809375, 7222584181
Offset: 1

Views

Author

Antti Karttunen, Feb 14 2015

Keywords

Crossrefs

First differences of A255061 and A255062.
A255069 gives the first differences of this sequence.
Analogous sequences: A213709, A219661.
a(n) differs from A192804(n+1) for the first time at n=11, where a(11) = 328, while A192804(12) = 327.

Programs

  • PARI
    A005811(n) = hammingweight(bitxor(n,n\2));
    A255071(n) = { my(k, i); k = (2^(n+1))-2; i = 1; while(1, k = k - A005811(k); if(!bitand(k+1,k+2),return(i),i++)); };
    for(n=1, 48, write("b255071.txt", n, " ", A255071(n)));
    
  • Scheme
    (define (A255071 n) (- (A255072 (- (expt 2 (+ n 1)) 2)) (A255072 (- (expt 2 n) 2))))
    (define (A255071shifted n) (add (COMPOSE A079944off2 A255056) (A255062 n) (A255061 (+ 1 n))))
    (define (A079944off2 n) (A000035 (floor->exact (/ n (A072376 n))))) ;; Cf.
    A079944.
    ;; Shifted variant gives: (map A255071shifted (iota 16)) --> (0 1 2 3 5 9 16 29 53 97 178 328 608 1134 2126 4001)

Formula

a(n) = A255072((2^(n+1))-2) - A255072((2^n)-2).
a(n) = A255061(n+1) - A255061(n).
a(n) = A255125(n) + A255126(n).
a(n) = A255063(n) + A255064(n).
Other identities and observations:
It seems that a(n) <= A213709(n) for all n >= 1. A254119 gives the difference between these two sequences.
From Antti Karttunen, Feb 21 2015: (Start)
For n>1, a(n-1) = Sum_{k=A255062(n) .. A255061(n+1)} secondmsb(A255056(k)).
Here secondmsb is implemented by the starting offset 2 version of A079944, and effectively gives the second most significant bit in the binary expansion of n. The formula follows from the semi-regular nature of number-of-runs beanstalk, as in the upper half of any next higher range [A255062(n+1) .. A255061(n+2)] of its infinite trunk (A255056), the beanstalk imitates its behavior in the range [A255062(n) .. A255061(n+1)].
(End)

Extensions

a(37) added by Antti Karttunen, Feb 19 2015

A255057 The trunk of number-of-runs beanstalk, halved: a(n) = A255056(n)/2.

Original entry on oeis.org

0, 1, 2, 3, 5, 6, 7, 9, 11, 13, 14, 15, 16, 18, 21, 23, 25, 27, 29, 30, 31, 32, 34, 37, 39, 42, 45, 47, 48, 50, 53, 55, 57, 59, 61, 62, 63, 64, 66, 69, 71, 74, 76, 78, 81, 84, 87, 90, 93, 95, 96, 98, 101, 103, 106, 109, 111, 112, 114, 117, 119, 121, 123, 125, 126, 127
Offset: 0

Views

Author

Antti Karttunen, Feb 14 2015

Keywords

Crossrefs

First differences: A255337.
Characteristic function: A255339.

Formula

a(n) = A255056(n)/2.
a(n) = A255067(A255122(n)).

A255126 Number of times a number of the form 4n+2 is encountered when iterating from 2^(n+1)-2 to (2^n)-2 with the map x -> x - (number of runs in binary representation of x).

Original entry on oeis.org

0, 1, 1, 2, 4, 6, 10, 16, 27, 50, 97, 188, 355, 652, 1177, 2126, 3886, 7204, 13501, 25465, 48192, 91411, 173851, 331821, 636035, 1224505, 2366662, 4588124, 8913418, 17338878, 33756650, 65766474, 128239805, 250346859, 489422205, 958304970, 1879145187, 3689012737
Offset: 0

Views

Author

Antti Karttunen, Feb 18 2015

Keywords

Comments

Also the number of odd numbers in range [A255062(n) .. A255061(n+1)] of A255057 (equally, in A255067). See the sum-formulas.

Examples

			For n=5 we start iterating with map m(n) = A236840(n) from the initial value (2^(5+1))-2 = 62. Thus we get m(62) = 60, m(60) = 58, m(58) = 54, m(54) = 50, m(50) = 46, m(46) = 42, m(42) = 36, m(36) = 32 and finally m(32) = 30, which is (2^5)-2. Of the nine numbers encountered, only 58, 54, 50, 46, 42 and 30 are of the form 4n+2, thus a(5) = 6. Note that the initial value 2^(n+1)-2 is not included in the cases, but the final (2^n) - 2 is.
		

Crossrefs

Programs

  • PARI
    \\ Use the PARI-code given in A255125.
    
  • Scheme
    (define (A255126 n) (if (zero? n) n (let loop ((i (- (expt 2 (+ 1 n)) 4)) (s 1)) (cond ((pow2? (+ 2 i)) s) (else (loop (- i (A005811 i)) (+ s (A021913 i))))))))
    ;; Alternatively:
    (define (A255126 n) (add (COMPOSE A000035 A255057) (A255062 n) (A255061 (+ 1 n))))
    (define (A255126 n) (add (COMPOSE A000035 A255067) (A255062 n) (A255061 (+ 1 n))))
    (define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (1+ i) (+ res (intfun i)))))))

Formula

a(n) = Sum_{k = A255062(n) .. A255061(n+1)} A000035(A255057(k)).
a(n) = Sum_{k = A255062(n) .. A255061(n+1)} A000035(A255067(k)).
a(n) = A255071(n) - A255125(n).

A255063 Number of times an evil number is encountered when iterating from 2^(n+1)-2 to (2^n)-2 with the map x -> x - (number of runs in binary representation of x).

Original entry on oeis.org

1, 0, 1, 2, 2, 5, 7, 14, 24, 52, 84, 173, 290, 586, 1038, 2025, 3740, 7177, 13498, 25832, 49027, 93918, 179291, 344128, 660058, 1270590, 2447944, 4728357, 9145214, 17718039, 34365068, 66717630, 129619518, 251953756, 489964171, 953141850, 1854911347
Offset: 0

Views

Author

Antti Karttunen, Feb 14 2015

Keywords

Examples

			For n=0 we count the evil numbers (A001969) found in range A255056(0..0), and A255056(0) = 0 is an evil number, thus a(0) = 1.
For n=1 we count the evil numbers in range A255056(1..1), and A255056(1) = 2 is not an evil number, thus a(1) = 0.
For n=2 we look at the numbers in range A255056(2..3), i.e. 4 and 6 and while 4 is not an evil number, 6 is, thus a(2) = 1.
For n=5 we look at the numbers in range A255056(12..20) which are (32, 36, 42, 46, 50, 54, 58, 60, 62). Or we take them in the order they come when iterating A236840 (as in A255066(12..20): 62, 60, 58, 54, 50, 46, 42, 36, 32), that is, we start iterating with map m(n) = A236840(n) from the initial value (2^(5+1))-2 = 62. Thus we get m(62) = 60, m(60) = 58, m(58) = 54, m(54) = 50, m(50) = 46, m(46) = 42, m(42) = 36 and finally m(36) = 32 which is (2^5). Of the nine numbers encountered, only 60, 58, 54, 46 and 36 are evil numbers, thus a(5) = 5.
		

Crossrefs

Programs

  • PARI
    \\ Compute sequences A255063, A255064 and A255071 at the same time, starting from n=1:
    A005811(n) = hammingweight(bitxor(n, n\2));
    write_A255063_and_A255064_and_A255071(n) = { my(k, i, s63, s64); k = (2^(n+1))-2; i = 1; s63 = 0; s64 = 0; while(1, if((hammingweight(k)%2),s64++,s63++); k = k - A005811(k); if(!bitand(k+1, k+2), break, i++)); write("b255063.txt", n, " ", s63); write("b255064.txt", n, " ", s64); write("b255071.txt", n, " ", i); };
    for(n=1,36,write_A255063_and_A255064_and_A255071(n));
    
  • Scheme
    (define (A255063 n) (if (zero? n) 1 (let loop ((i (- (expt 2 (+ 1 n)) 4)) (s (modulo (+ 1 n) 2))) (cond ((pow2? (+ 2 i)) s) (else (loop (- i (A005811 i)) (+ s (A010059 i))))))))
    (define (pow2? n) (and (> n 0) (zero? (A004198bi n (- n 1)))))
    
  • Scheme
    (define (A255063 n) (add A254113 (A255062 n) (A255061 (+ 1 n))))
    
  • Scheme
    (define (A255063 n) (add (COMPOSE A010059 A255066) (A255062 n) (A255061 (+ 1 n))))

Formula

a(n) = Sum_{k = A255062(n) .. A255061(n+1)} A254113(k).
a(n) = Sum_{k = A255062(n) .. A255061(n+1)} A010059(A255066(k)).
Other identities. For all n >= 1:
a(n) = A255071(n) - A255064(n).

A255067 Terms of A255066 halved.

Original entry on oeis.org

0, 1, 3, 2, 7, 6, 5, 15, 14, 13, 11, 9, 31, 30, 29, 27, 25, 23, 21, 18, 16, 63, 62, 61, 59, 57, 55, 53, 50, 48, 47, 45, 42, 39, 37, 34, 32, 127, 126, 125, 123, 121, 119, 117, 114, 112, 111, 109, 106, 103, 101, 98, 96, 95, 93, 90, 87, 84, 81, 78, 76, 74, 71, 69, 66, 64, 255
Offset: 0

Views

Author

Antti Karttunen, Feb 14 2015

Keywords

Crossrefs

Programs

Formula

a(n) = A255066(n)/2.
Other identities. For all n >= 0:
a(n) = A255057(A255122(n)).

A255332 Partial sums of A255331.

Original entry on oeis.org

-1, -1, -1, -5, -4, -4, -11, -11, -14, -13, -13, -10, -10, -16, -16, -22, -22, -25, -24, -24, -21, -21, -33, -33, -33, -38, -38, -34, -34, -40, -40, -46, -46, -49, -48, -48, -45, -45, -57, -57, -57, -50, -49, -61, -59, -59, -59, -64, -64, -60, -60, -72, -72, -72, -77, -77, -73, -73, -79, -79, -85, -85, -88, -87, -87, -84
Offset: 0

Views

Author

Antti Karttunen, Feb 21 2015

Keywords

Comments

a(805) = 54 is the first positive term.
Is a(836) = -32 the last negative term?
The conspicuous "noncontinuity" which occurs in the scatter plot for the first time at n=5790 is caused by a sudden negative record at A255331(5790) = -708. Note that A255328(5790) = 708.

Crossrefs

Analogous sequences: A218789, A230409.

Formula

a(0) = -1; for n >= 1: a(n) = a(n-1) + A255331(n).

A255069 First differences of A255071.

Original entry on oeis.org

1, 1, 2, 4, 7, 13, 24, 44, 81, 150, 280, 526, 992, 1875, 3551, 6740, 12823, 24450, 46709, 89383, 171325, 328962, 632849, 1219909, 2356217, 4559224, 8835610, 17144046, 33295497, 64705083, 125802338, 244673791, 476011284, 926373373, 1803512210, 3512774806
Offset: 1

Views

Author

Antti Karttunen, Feb 21 2015

Keywords

Comments

Also, a(n) = the number of times a number whose binary expansion begins with 10... (cf. A004754) is encountered when iterating from 2^(n+2)-2 to (2^(n+1))-2 with the map x -> x - (number of runs in binary representation of x), i.e., with m(n) = A236840(n). For example, when starting from the initial value (2^(4+2))-2 = 62, we get m(62) = 60, m(60) = 58, m(58) = 54, m(54) = 50, m(50) = 46, m(46) = 42, m(42) = 36 and finally m(36) = 32, which is (2^(4+1)). Of the nine numbers encountered, only 46, 42, 36 and 32 (in binary: 101110, 101010, 100100 and 100000) are in A004754, thus a(4) = 5.

Crossrefs

First differences of A255071.
Analogous sequence: A226060.

Programs

Formula

a(n) = A255071(n+1) - A255071(n).
For n > 1, a(n-1) = Sum_{k = A255062(n) .. A255061(n+1)}(1-secondmsb(A255056(k))).
Here secondmsb is implemented by the starting offset 2 version of A079944, and effectively gives the second most significant bit in the binary expansion of n. The formula follows from the semi-regular nature of number-of-runs beanstalk, see comments above and at A255071.
Showing 1-8 of 8 results.