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

A257259 a(n) = A218542(n) - A218543(n).

Original entry on oeis.org

1, -1, 0, -1, -1, -3, -1, -6, -8, -10, -7, -4, 2, 2, -14, -90, -318, -896, -2166, -4691, -9298, -17175, -30007, -50261, -81664, -129637, -200973, -301205, -426500, -545183, -561511, -252122, 836543, 3542930, 9312475, 20508985, 40858087, 76119037, 135203839, 232236417, 390709345, 652711050, 1101492173, 1921013671, 3558812217, 7170401227, 15800043812, 37400877416
Offset: 0

Views

Author

Antti Karttunen, May 13 2015

Keywords

Comments

a(n) = the difference between the number of even and odd numbers encountered when traversing from 2^(n+1)-1 to (2^n)-1 by iterating the map A011371: x -> x - (number of 1's in binary representation of x).

Crossrefs

Partial sums: A257805.

Programs

Formula

a(n) = A218542(n) - A218543(n).

A213709 Number of steps to go from 2^(n+1)-1 to (2^n)-1 using the iterative process described in A071542.

Original entry on oeis.org

1, 1, 2, 3, 5, 9, 17, 30, 54, 98, 179, 330, 614, 1150, 2162, 4072, 7678, 14496, 27418, 51979, 98800, 188309, 359889, 689649, 1325006, 2552031, 4926589, 9529551, 18463098, 35815293, 69534171, 135069124, 262448803, 510047416, 991381433, 1927317745, 3747885517
Offset: 0

Views

Author

Antti Karttunen, Oct 26 2012

Keywords

Comments

Also, apart from the first term a(0)=1, the number of terms in A179016 whose binary width is n+2 bits and whose second most significant bit is zero. For example, there is one term 4 (100) in three-bit range; two terms 8 (1000) and 11 (1011) in four bit range; three such terms: 16 (10000), 19 (10011) and 23 (10111) in five-bit range; five terms: 32, 35, 39, 42, 46 in six-bit range. This stems from the half-recursive nature of A179016, especially, that for all n >= 4, a(n) also gives the number of steps to go from (2^(n+1) + 2^n + 1) to 2^n using the iterative process described in A071542. Cf. also A226060. - Antti Karttunen, Jun 12 2013
Ratio a(n+1)/a(n) develops as: 1, 2, 1.5, 1.667..., 1.8, 1.889..., 1.765..., 1.8, 1.815..., 1.827..., 1.844..., 1.861..., 1.873..., 1.880..., 1.883..., 1.886..., 1.888..., 1.891..., 1.896..., 1.901..., 1.906..., 1.911..., 1.916..., 1.921..., 1.926..., 1.930..., 1.934..., 1.937..., 1.940..., 1.941..., 1.942..., 1.943..., 1.943..., 1.944..., 1.944..., 1.945..., 1.945..., 1.946..., 1.947..., 1.949..., 1.950..., 1.951..., 1.953..., 1.954..., 1.955..., 1.957..., 1.958... (which seem to converge slowly towards 2; see also comments at A218543).

Examples

			(2^0)-1 (0) is reached from (2^1)-1 (1) with one step by subtracting A000120(1) from 1.
(2^1)-1 (1) is reached from (2^2)-1 (3) with one step by subtracting A000120(3) from 3.
(2^2)-1 (3) is reached from (2^3)-1 (7) with two steps by first subtracting A000120(7) from 7 -> 4, and then subtracting A000120(4) from 4 -> 3.
Thus a(0)=a(1)=1 and a(2)=2.
		

Crossrefs

First differences of A218600 and A213710. First differences of this sequence: A226060.
Analogous sequence for factorial number system: A219661.

Formula

a(n) = A071542((2^(n+1))-1) - A071542((2^n)-1).
a(n) = A218542(n) + A218543(n) = A011782(n) - A213722(n).

Extensions

More terms from Antti Karttunen, Jun 05 2013

A257806 a(n) = A257808(n) - A257807(n).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, May 12 2015

Keywords

Comments

Alternative description: Start with a(0) = 0, and then to obtain each a(n), look at each successive term in the infinite trunk of inverted binary beanstalk, from A233271(1) onward, subtracting one from a(n-1) if A233271(n) is odd, and adding one to a(n-1) if A233271(n) is even.
In other words, starting from zero, iterate the map x -> {x + 1 + number of nonleading zeros in the binary representation of x}, and note each time whether the result is odd or even: With odd results go one step down, and even results go one step up.
After the zeros at a(0), a(2) and a(4) and -1 at a(1), the terms stay strictly positive for a long time, although from the terms of A257805 it can be seen that the sequence must again fall to the negative side somewhere between n = 541110611 and n = 1051158027 (i.e., A218600(33) .. A218600(34)). Indeed the fourth zero occurs at n = 671605896, and the second negative term right after that as a(671605897) = -1.
The maximum positive value reached prior to the slide into negative territory is 2614822 for a(278998626) and a(278998628). - Hans Havermann, May 23 2015

Examples

			We consider 0 to have no nonleading zeros, so first we get to 0 -> 0+1+0 = 1, and 1 is odd, so we go one step down from the starting value a(0)=0, and thus a(1) = -1.
1 has no nonleading zeros, so we get 1 -> 1+1+0 = 2, and 2 is even, so we go one step up, and thus a(2) = 0.
2 has one nonleading zero in binary "10", so we get 2 -> 2+1+1 = 4, and 4 is also even, so we go one step up, and thus a(3) = 1.
4 has two nonleading zeros in binary "100", so we get 4 -> 4+2+1 = 7, 7 is odd, so we go one step down, and thus a(4) = 0.
		

Crossrefs

Cf. also A218542, A218543, A218789 and A233270 (compare the scatter plots).

Programs

Formula

a(n) = A257808(n) - A257807(n).
a(0) = 0; and for n >= 1, a(n) = a(n-1) + (-1)^A233271(n).
Other identities. For all n >= 0:
a(A218600(n+1)) = -A257805(n).

A218542 Number of times when an even number is encountered, when going from 2^(n+1)-1 to (2^n)-1 using the iterative process described in A071542.

Original entry on oeis.org

1, 0, 1, 1, 2, 3, 8, 12, 23, 44, 86, 163, 308, 576, 1074, 1991, 3680, 6800, 12626, 23644, 44751, 85567, 164941, 319694, 621671, 1211197, 2362808, 4614173, 9018299, 17635055, 34486330, 67408501, 131642673, 256795173, 500346954, 973913365, 1894371802, 3683559071
Offset: 0

Views

Author

Antti Karttunen, Nov 02 2012

Keywords

Comments

Ratio a(n)/A213709(n) develops as: 1, 0, 0.5, 0.333..., 0.4, 0.333..., 0.471..., 0.400..., 0.426..., 0.449..., 0.480..., 0.494..., 0.502..., 0.501..., 0.497..., 0.489..., 0.479..., 0.469..., 0.461..., 0.455..., 0.453..., 0.454..., 0.458..., 0.464..., 0.469..., 0.475..., 0.480..., 0.484..., 0.488..., 0.492..., 0.496..., 0.499..., 0.502..., 0.503..., 0.505..., 0.505..., 0.505..., 0.505..., 0.505..., 0.504..., 0.504..., 0.503..., 0.503..., 0.502..., 0.502..., 0.502..., 0.503..., 0.503... (See further comments at A218543).

Examples

			(2^0)-1 (0) is reached from (2^1)-1 (1) with one step by subtracting A000120(1) from 1. Zero is an even number, so a(0)=1.
(2^1)-1 (1) is reached from (2^2)-1 (3) with one step by subtracting A000120(3) from 3. One is not an even number, so a(1)=0.
(2^2)-1 (3) is reached from (2^3)-1 (7) with two steps by first subtracting A000120(7) from 7 -> 4, and then subtracting A000120(4) from 4 -> 3. Four is an even number, but three is not, so a(2)=1.
		

Crossrefs

Cf. A219662 (analogous sequence for factorial number system).

Formula

a(n) = Sum_{i=A218600(n) .. (A218600(n+1)-1)} A213728(i).
a(n) = A213709(n) - A218543(n).

Extensions

More terms from Antti Karttunen, Jun 05 2013

A218789 Partial sums of A218618.

Original entry on oeis.org

0, 1, 0, 1, 0, 3, 4, 3, 6, 11, 10, 11, 10, 13, 18, 17, 10, 11, 12, 15, 16, 15, 18, 23, 22, 15, 16, 17, 20, 13, 14, 15, 10, 11, 6, 3, 2, 3, 2, 5, 10, 9, 2, 3, 4, 7, 0, 1, 2, -3, -2, -7, -10, -11, -18, -17, -16, -21, -20, -9, -8, -7, 6, 7, 2, 1, 4, 5, 4, 7, 12
Offset: 0

Views

Author

Antti Karttunen, Dec 03 2012

Keywords

Comments

The term a(n) indicates approximately the "balance" of the binary beanstalk (cf. A179016) at n steps up from the root, which in turn has repercussions for the sequences such as A218542 and A218543.

Crossrefs

A219662 Number of times an even number is encountered, when going from (n+1)!-1 to n!-1 using the iterative process described in A219652.

Original entry on oeis.org

1, 1, 2, 10, 49, 268, 1505, 9667, 81891, 779193, 7726623, 80770479, 921442854, 11621384700, 159894957124
Offset: 1

Views

Author

Antti Karttunen, Dec 03 2012

Keywords

Comments

At least for n=7, 8, 9 and 10, a(n) is equal to a(n+1) when taken modulo n.

Examples

			(1!)-1 (0) is reached from (2!)-1 (1) with one step by subtracting A034968(1) from 1. Zero is an even number, so a(1)=1.
(2!)-1 (1) is reached from (3!)-1 (5) with two steps by first subtracting A034968(5) from 5 -> 2, and then subtracting A034968(2) from 2 -> 1. Two is an even number, but one is not, so a(2)=1.
(3!)-1 (5) is reached from (4!)-1 (23) with five steps by repeatedly subtracting the sum of digits in factorial expansion as: 23 - 6 = 17, 17 - 5 = 12, 12 - 2 = 10, 10 - 3 = 7, 7 - 2 = 5. Of these only 12 and 10 are even numbers, so a(3)=2.
		

Crossrefs

Programs

  • Scheme
    (definec (A219662 n) (if (< n 2) n (let loop ((i (- (A000142 (1+ n)) (A000217 n) 1)) (s 0)) (cond ((isA000142? (1+ i)) (+ s (- 1 (modulo i 2)))) (else (loop (A219651 i) (+ s (- 1 (modulo i 2)))))))))
    (define (isA000142? n) (and (> n 0) (let loop ((n n) (i 2)) (cond ((= 1 n) #t) ((not (zero? (modulo n i))) #f) (else (loop (/ n i) (1+ i)))))))

Formula

a(n) = A219661(n) - A219663(n).

A219663 Number of times an odd number is encountered, when going from (n+1)!-1 to n!-1 using the iterative process described in A219652.

Original entry on oeis.org

0, 1, 3, 9, 34, 160, 1106, 8806, 68835, 598355, 6124625, 71839629, 913850187, 12304189279, 175964165619
Offset: 1

Views

Author

Antti Karttunen, Dec 03 2012

Keywords

Comments

Ratio a(n)/A219662(n) develops as follows:
0, 1, 1.5, 0.9, 0.694..., 0.597..., 0.735..., 0.911..., 0.841..., 0.768..., 0.793..., 0.889..., 0.992..., 1.059..., 1.100...
Compare this to how the ratio A218543(n)/A218542(n) develops (ratios listed in entry A218543) and see also the associated graphs plotted by OEIS Server.

Examples

			(1!)-1 (0) is reached from (2!)-1 (1) with one step by subtracting A034968(1) from 1. Zero is not an odd number, so a(1)=0.
(2!)-1 (1) is reached from (3!)-1 (5) with two steps by first subtracting A034968(5) from 5 -> 2, and then subtracting A034968(2) from 2 -> 1. Two is not an odd number, but one is, so a(2)=1.
(3!)-1 (5) is reached from (4!)-1 (23) with five steps by repeatedly subtracting the sum of digits in factorial expansion as: 23 - 6 = 17, 17 - 5 = 12, 12 - 2 = 10, 10 - 3 = 7, 7 - 2 = 5. Of these (after 23) only 17, 7 and 5 are odd numbers, so a(3)=3.
		

Crossrefs

Programs

  • Scheme
    (definec (A219663 n) (if (< n 2) 0 (let loop ((i (- (A000142 (1+ n)) (A000217 n) 1)) (s 0)) (cond ((isA000142? (1+ i)) (+ s (modulo i 2))) (else (loop (A219651 i) (+ s (modulo i 2))))))))
    (define (isA000142? n) (and (> n 0) (let loop ((n n) (i 2)) (cond ((= 1 n) #t) ((not (zero? (modulo n i))) #f) (else (loop (/ n i) (1+ i)))))))

Formula

a(n) = A219661(n) - A219662(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).

A255064 Number of times an odious 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

0, 1, 1, 1, 3, 4, 9, 15, 29, 45, 94, 155, 318, 548, 1088, 1976, 3812, 7115, 13617, 25733, 49247, 93739, 179691, 343816, 660735, 1270112, 2448975, 4727786, 9146539, 17717760, 34366228, 66718749, 129619199, 251958752, 489959621, 953155315, 1854898028
Offset: 0

Views

Author

Antti Karttunen, Feb 14 2015

Keywords

Examples

			For n=0 we count the odious numbers (A000069) found in range A255056(0..0), and A255056(0) = 0 is not an odious number, thus a(0) = 0.
For n=1 we count the odious numbers in range A255056(1..1), and A255056(1) = 2 is an odious number, thus a(1) = 1.
For n=2 we look at the numbers in range A255056(2..3), i.e. 4 and 6 and while 4 is an odious number, 6 is not, 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 if we take them in the order the 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 62, 50, 42 and 32 are odious numbers, thus a(5) = 4.
		

Crossrefs

Programs

Formula

a(n) = Sum_{k = A255062(n) .. A255061(n+1)} A254114(k).
a(n) = Sum_{k = A255062(n) .. A255061(n+1)} A010060(A255066(k)).
Other identities. For all n >= 1:
a(n) = A255071(n) - A255063(n).

A257805 Partial sums of A257259: a(0) = 1; for n >= 1, a(n) = A257259(n) + a(n-1).

Original entry on oeis.org

1, 0, 0, -1, -2, -5, -6, -12, -20, -30, -37, -41, -39, -37, -51, -141, -459, -1355, -3521, -8212, -17510, -34685, -64692, -114953, -196617, -326254, -527227, -828432, -1254932, -1800115, -2361626, -2613748, -1777205, 1765725, 11078200, 31587185, 72445272, 148564309, 283768148, 516004565, 906713910, 1559424960, 2660917133, 4581930804, 8140743021, 15311144248, 31111188060, 68512065476
Offset: 0

Views

Author

Antti Karttunen, May 13 2015

Keywords

Crossrefs

Formula

a(0) = 1; for n >= 1, a(n) = A257259(n) + A257805(n-1).
Other identities. For all n >= 0:
a(n) = -A257806(A218600(n+1)).
Showing 1-10 of 10 results.