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 14 results. Next

A255122 Simple self-inverse permutation of natural numbers: after zero, list each block of A255071(n) numbers in reverse order, from A255061(n+1) to A255062(n).

Original entry on oeis.org

0, 1, 3, 2, 6, 5, 4, 11, 10, 9, 8, 7, 20, 19, 18, 17, 16, 15, 14, 13, 12, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 118
Offset: 0

Views

Author

Antti Karttunen, Feb 14 2015

Keywords

Comments

Maps between A255056 and A255066. (Equally, between A255057 and A255067.)

Crossrefs

Programs

Formula

a(n) = A255061(1+A255121(n)) - A255120(n).

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

A236840 n minus number of runs in the binary expansion of n: a(n) = n - A005811(n).

Original entry on oeis.org

0, 0, 0, 2, 2, 2, 4, 6, 6, 6, 6, 8, 10, 10, 12, 14, 14, 14, 14, 16, 16, 16, 18, 20, 22, 22, 22, 24, 26, 26, 28, 30, 30, 30, 30, 32, 32, 32, 34, 36, 36, 36, 36, 38, 40, 40, 42, 44, 46, 46, 46, 48, 48, 48, 50, 52, 54, 54, 54, 56, 58, 58, 60, 62, 62, 62, 62, 64, 64, 64
Offset: 0

Views

Author

Antti Karttunen, Apr 18 2014

Keywords

Comments

All terms are even. Used by the "number-of-runs beanstalk" sequence A255056 and many of its associated sequences.

Crossrefs

Cf. A091067 (the positions of records), A106836 (run lengths).
Cf. A255070 (terms divided by 2).

Programs

  • Maple
    A236840 := proc(n) local i, b; if n=0 then 0 else b := convert(n, base, 2); select(i -> (b[i-1]<>b[i]), [$2..nops(b)]); n-1-nops(%) fi end: seq(A236840(i), i=0..69); # Peter Luschny, Apr 19 2014
  • Mathematica
    a[n_] := n - Length@ Split[IntegerDigits[n, 2]]; a[0] = 0; Array[a, 100, 0] (* Amiram Eldar, Jul 16 2023 *)
  • Scheme
    (define (A236840 n)  (- n (A005811 n)))

Formula

a(n) = n - A005811(n) = n - A000120(A003188(n)).
a(n) = 2*A255070(n).

A255061 Number of steps to reach 0 when starting from (2^n)-2 and iterating the map x -> x - (number of runs in binary representation of x): a(n) = A255072(A000918(n)).

Original entry on oeis.org

0, 1, 3, 6, 11, 20, 36, 65, 118, 215, 393, 721, 1329, 2463, 4589, 8590, 16142, 30434, 57549, 109114, 207388, 395045, 754027, 1441971, 2762764, 5303466, 10200385, 19656528, 37948281, 73384080, 142115376, 275551755, 534790472, 1038702980, 2018626772, 3924923937, 7634733312
Offset: 1

Views

Author

Antti Karttunen, Feb 14 2015

Keywords

Comments

Apart from a(1)=1, also gives the positions of ones in A255054.

Crossrefs

One less than A255062.
First differences: A255071.
Apart from a(1)=1, a subsequence of A255059.
Analogous sequences: A218600, A226061.

Programs

Formula

a(n) = A255072(A000918(n)).
a(1) = 0; for n > 1, a(n) = a(n-1) + A255071(n-1).
Other identities. For all n >= 1:
a(n) = A255062(n) - 1.

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

A213710 Number of steps to reach 0 when starting from 2^n and iterating the map x -> x - (number of 1's in binary representation of x): a(n) = A071542(2^n) = A218600(n)+1.

Original entry on oeis.org

1, 2, 3, 5, 8, 13, 22, 39, 69, 123, 221, 400, 730, 1344, 2494, 4656, 8728, 16406, 30902, 58320, 110299, 209099, 397408, 757297, 1446946, 2771952, 5323983, 10250572, 19780123, 38243221, 74058514, 143592685, 278661809, 541110612, 1051158028, 2042539461, 3969857206
Offset: 0

Views

Author

Antti Karttunen, Oct 26 2012

Keywords

Comments

Conjecture: A179016(a(n))= 2^n for all n apart from n=2. This is true if all powers of 2 except 2 itself occur in A179016 as in that case they must occur at positions given by this sequence.
This is easy to prove: It suffices to note that after 3 no integer of form (2^k)+1 can occur in A005187, thus for all k >= 2, A213725((2^k)+1) = 1 or equally: A213714((2^k)+1) = 0. - Antti Karttunen, Jun 12 2013

Crossrefs

One more than A218600, which is the partial sums of A213709, thus the latter also gives the first differences of this sequence.
Analogous sequences: A219665, A255062.

Formula

a(n) = A071542(A000079(n)) = A071542(2^n).
a(n) = 1 + A218600(n).

Extensions

a(29)-a(36) from Alois P. Heinz, Jul 03 2022

A255072 Number of steps to reach 0 starting with n and using the iterated process: x -> x - (number of runs in binary representation of x).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Feb 14 2015

Keywords

Crossrefs

Cf. A255053 (least inverse), A255055 (greatest inverse), A255054 (run lengths).
Cf. A255061 & A255062 (values at points (2^n)-2 and (2^n)-1).
Analogous sequences: A071542, A219642, A219652

Formula

a(0) = 0; for n >= 1, a(n) = 1 + a(A236840(n)) = 1 + a(n - A005811(n)).
Other identities. For all n >= 0:
a(A255053(n)) = a(A255055(n)) = n.
a(A255056(n)) = n. [This sequence works also as an inverse function for number-of-runs beanstalk A255056.]

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

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).
Showing 1-10 of 14 results. Next