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).

A218543 Number of times when an odd 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

0, 1, 1, 2, 3, 6, 9, 18, 31, 54, 93, 167, 306, 574, 1088, 2081, 3998, 7696, 14792, 28335, 54049, 102742, 194948, 369955, 703335, 1340834, 2563781, 4915378, 9444799, 18180238, 35047841, 67660623, 130806130, 253252243, 491034479, 953404380, 1853513715, 3607440034
Offset: 0

Views

Author

Antti Karttunen, Nov 02 2012

Keywords

Comments

Ratio a(n)/A213709(n) develops as: 0, 1, 0.5, 0.666..., 0.6, 0.666..., 0.529..., 0.6, 0.574..., 0.551..., 0.520..., 0.506..., 0.498..., 0.499..., 0.503..., 0.511..., 0.521..., 0.531..., 0.539..., 0.545..., 0.547..., 0.546..., 0.542..., 0.536..., 0.531..., 0.525..., 0.520..., 0.516..., 0.512..., 0.508..., 0.504..., 0.501..., 0.498..., 0.497..., 0.495..., 0.495..., 0.495..., 0.495..., 0.495..., 0.496..., 0.496..., 0.497..., 0.497..., 0.498..., 0.498..., 0.498..., 0.497..., 0.497...
Ratio a(n)/A218542(n) develops as follows from n>=2 onward:
1, 2, 1.5, 2, 1.125, 1.5, 1.348..., 1.227..., 1.081..., 1.025..., 0.994..., 0.997..., 1.013..., 1.045..., 1.086..., 1.132..., 1.172..., 1.198..., 1.208..., 1.201..., 1.182..., 1.157..., 1.131..., 1.107..., 1.085..., 1.065..., 1.047..., 1.031..., 1.016..., 1.004..., 0.994..., 0.986..., 0.981..., 0.979..., 0.978..., 0.979..., 0.981..., 0.983..., 0.986..., 0.988..., 0.989..., 0.990..., 0.991..., 0.991..., 0.989..., 0.987...
Observation: A179016 seems to alternatively slightly favor the odd numbers and then again the even numbers, at least for the terms computed so far.
Please plot this sequence against A218542 in the "ratio mode" (given as a link) to see how smoothly (almost "continuously") the ratios given above develop.
What is the reason for that smoothness? (Conjecture: The distribution of "tendrils", i.e. finite subtrees in the beanstalk and its almost fractal nature? Cf: A218787.)

Examples

			(2^0)-1 (0) is reached from (2^1)-1 (1) with one step by subtracting A000120(1) from 1. Zero is not an odd number, so a(0)=0.
(2^1)-1 (1) is reached from (2^2)-1 (3) with one step by subtracting A000120(3) from 3. One is an odd number, so a(1)=1.
(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 not an odd number, but three is, so a(2)=1.
		

Crossrefs

a(n) = A213709(n)-A218542(n). Cf. A213733, A218787, A218789.
Analogous sequence for factorial number system: A219663.

Formula

a(n) = Sum_{i=A218600(n) .. (A218600(n+1)-1)} A213729(i)

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

A255125 Number of times a multiple of four 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, 1, 1, 3, 6, 13, 26, 47, 81, 140, 253, 482, 949, 1875, 3666, 7088, 13614, 26100, 50082, 96246, 185131, 356123, 684758, 1316197, 2530257, 4868019, 9378335, 18096921, 34974646, 67669905, 130998912, 253565649, 490501587, 947992195, 1830664188, 3533571444
Offset: 0

Views

Author

Antti Karttunen, Feb 18 2015

Keywords

Comments

Also the number of even 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 60, 36 and 32 are multiples of four, thus a(5) = 3.
		

Crossrefs

Programs

  • PARI
    A005811(n) = hammingweight(bitxor(n, n\2));
    write_A255125_and_A255126_and_A255071(n) = { my(k, i, s25, s26); k = (2^(n+1))-2; i = 1; s25 = 0; s26 = 0; while(1, if((k%4),s26++,s25++); k = k - A005811(k); if(!bitand(k+1, k+2), break, i++)); write("b255125.txt", n, " ", s25); write("b255126.txt", n, " ", s26); write("b255071.txt", n, " ", i); };
    for(n=1,42,write_A255125_and_A255126_and_A255071(n));
    
  • Scheme
    (define (A255125 n) (if (zero? n) 1 (let loop ((i (- (expt 2 (+ 1 n)) 4)) (s 0)) (cond ((pow2? (+ 2 i)) s) (else (loop (- i (A005811 i)) (+ s (A133872 i))))))))
    ;; Alternatively:
    (define (A255125 n) (add (COMPOSE A059841 A255057) (A255062 n) (A255061 (+ 1 n))))
    (define (A255125 n) (add (COMPOSE A059841 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)} A059841(A255057(k)).
a(n) = Sum_{k = A255062(n) .. A255061(n+1)} A059841(A255067(k)).
a(n) = A255071(n) - A255126(n).

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).

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).

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.