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

A255070 (1/2)*(n minus number of runs in the binary expansion of n): a(n) = (n - A005811(n)) / 2 = A236840(n)/2.

Original entry on oeis.org

0, 0, 0, 1, 1, 1, 2, 3, 3, 3, 3, 4, 5, 5, 6, 7, 7, 7, 7, 8, 8, 8, 9, 10, 11, 11, 11, 12, 13, 13, 14, 15, 15, 15, 15, 16, 16, 16, 17, 18, 18, 18, 18, 19, 20, 20, 21, 22, 23, 23, 23, 24, 24, 24, 25, 26, 27, 27, 27, 28, 29, 29, 30, 31, 31, 31, 31, 32, 32, 32, 33, 34, 34, 34, 34, 35
Offset: 0

Views

Author

Antti Karttunen, Feb 14 2015

Keywords

Crossrefs

Least inverse: A091067 (also the positions of records).
Greatest inverse: A255068.
Run lengths: A106836.

Programs

  • Mathematica
    a[n_] := (n - Length@ Split[IntegerDigits[n, 2]])/2; a[0] = 0; Array[a, 100, 0] (* Amiram Eldar, Jul 16 2023 *)
  • Scheme
    (define (A255070 n) (/ (A236840 n) 2))

Formula

a(n) = A236840(n) / 2 = (n - A005811(n)) / 2.
Other identities:
a(A091067(n)) = n for all n >= 1.
a(A255068(n)) = n for all n >= 0.
a(A269363(n)) = A269367(n). - Antti Karttunen, Aug 12 2019

A091067 Numbers whose odd part is of the form 4k+3.

Original entry on oeis.org

3, 6, 7, 11, 12, 14, 15, 19, 22, 23, 24, 27, 28, 30, 31, 35, 38, 39, 43, 44, 46, 47, 48, 51, 54, 55, 56, 59, 60, 62, 63, 67, 70, 71, 75, 76, 78, 79, 83, 86, 87, 88, 91, 92, 94, 95, 96, 99, 102, 103, 107, 108, 110, 111, 112, 115, 118, 119, 120, 123, 124, 126, 127, 131
Offset: 1

Views

Author

Ralf Stephan, Feb 22 2004

Keywords

Comments

Either of form 2*a(m) or 4k+3, k >= 0, 0 < m < n.
A000265(a(n)) is an element of A004767.
a(n) such that A038189(a(n)) = 1.
Numbers n such that Kronecker(-n, m) = Kronecker(m, n) for all m. - Michael Somos, Sep 22 2005
From Antti Karttunen, Feb 20-21 2015: (Start)
Gives all n for which A005811(n) - A005811(n-1) = -1, from which follows that a(n) = the least k such that A255070(k) = n.
Gives the positions of even terms in A003602. (End)
Indices of negative terms in A164677. - M. F. Hasler, Aug 06 2015
Indices of the 0's in A014577. - Gabriele Fici, Jun 02 2016
Also indices of -1 in A034947. - Jianing Song, Apr 24 2021
Conjecture: alternate definition of same sequence is that a(1)=3 and a(n) is the smallest number > a(n-1) so that no number that is the sum of at most 2 terms in this sequence is a power of 2. - J. Lowell, Jan 20 2024
The asymptotic density of this sequence is 1/2. - Amiram Eldar, Aug 31 2024

Crossrefs

Essentially one less than A060833.
Characteristic function: A038189.
Complement of A091072.
First differences are in A106836 (from its second term onward).
Sequence A246590 gives the even terms.
Gives the positions of records (after zero) for A255070 (equally, the position of the first n there).
Cf. A106837 (gives n such that both n and n+1 are terms of this sequence).
Cf. A098502 (gives n such that both n and n+2 are, but n+1 is not in this sequence).

Programs

  • Haskell
    import Data.List (elemIndices)
    a091067 n = a091067_list !! (n-1)
    a091067_list = map (+ 1) $ elemIndices 1 a014707_list
    -- Reinhard Zumkeller, Sep 28 2011
    (Scheme, with Antti Karttunen's IntSeq-library, two versions)
    (define A091067 (MATCHING-POS 1 1 (COMPOSE even? A003602)))
    (define A091067 (NONZERO-POS 1 0 A038189))
    ;; Antti Karttunen, Feb 20 2015
  • Mathematica
    Select[Range[150], Mod[# / 2^IntegerExponent[#, 2], 4] == 3 &] (* Amiram Eldar, Aug 31 2024 *)
  • PARI
    for(n=1,200,if(((n/2^valuation(n,2)-1)/2)%2,print1(n",")))
    
  • PARI
    {a(n) = local(m, c); if( n<1, 0, c=0; m=1; while( cMichael Somos, Sep 22 2005 */
    
  • PARI
    is_A091067(n)=bittest(n,valuation(n,2)+1) \\ M. F. Hasler, Aug 06 2015
    
  • PARI
    a(n) = my(t=1); n<<=1; forstep(i=logint(n,2),0,-1, if(bittest(n,i)==t, n++;t=!t)); n; \\ Kevin Ryde, Mar 21 2021
    

Formula

a(n) = A060833(n+1) - 1. [See N. Sato's Feb 12 2013 comment in A060833.]
Other identities. For all n >= 1 it holds that:
A014707(a(n) + 1) = 1. - Reinhard Zumkeller, Sep 28 2011
A055975(a(n)) < 0. - Reinhard Zumkeller, Apr 28 2012
From Antti Karttunen, Feb 20-21 2015: (Start)
a(n) = A246590(n)/2.
A255070(a(n)) = n, or equally, A236840(a(n)) = 2n.
a(n) = 1 + A255068(n-1). (End)

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

A255131 n minus the least number of squares that add up to n: a(n) = n - A002828(n).

Original entry on oeis.org

0, 0, 0, 0, 3, 3, 3, 3, 6, 8, 8, 8, 9, 11, 11, 11, 15, 15, 16, 16, 18, 18, 19, 19, 21, 24, 24, 24, 24, 27, 27, 27, 30, 30, 32, 32, 35, 35, 35, 35, 38, 39, 39, 40, 41, 43, 43, 43, 45, 48, 48, 48, 50, 51, 51, 51, 53, 54, 56, 56, 56, 59, 59, 59, 63, 63, 63, 64, 66, 66, 67, 67, 70, 71, 72, 72, 73, 74, 75, 75, 78, 80, 80, 80, 81
Offset: 0

Views

Author

Antti Karttunen, Feb 24 2015

Keywords

Comments

The associated beanstalk-sequence starts from a(0) as: 0, 3, 6, 8, 11, 15, 16, 18, 21, ... (A276573).

Examples

			a(0) = 0, because no squares are needed for an empty sum, and 0 - 0 = 0.
a(3) = 0, because 3 cannot be represented as a sum of less than three squares (1+1+1), and 3 - 3 = 0.
a(4) = 3, because 4 can be represented as a sum of just one square (namely 4 itself), and 4 - 1 = 3.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local F, x;
       if issqr(n) then return n-1 fi;
       if nops(select(t -> t[1] mod 4 = 3 and t[2]::odd, ifactors(n)[2])) = 0 then return n-2 fi;
       x:= n/4^floor(padic:-ordp(n, 2)/2);
       if x mod 8 = 7 then n-4 else n-3 fi
    end proc:
    f(0):= 0:
    map(f, [$0..100]); # Robert Israel, Mar 27 2018
  • Mathematica
    {0}~Join~Table[n - (If[First@ # > 0, 1, Length[First@ Split@ #] + 1] &@ SquaresR[Range@ 4, n]), {n, 84}] (* Michael De Vlieger, Sep 08 2016, after Harvey P. Dale at A002828 *)

Formula

a(n) = n - A002828(n).
a(n) = A260740(n) + A062535(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

A255327 a(n) = 0 if n is in the infinite trunk of "number-of-runs beanstalk" (one of the terms of A255056), otherwise number of nodes (including leaves and the node n itself) in that finite subtree of the beanstalk.

Original entry on oeis.org

0, 1, 0, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 5, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3, 1, 0, 1, 2, 1, 4, 1, 0, 1, 2, 1, 0, 1, 5, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3, 1, 0, 1, 2, 1, 10, 1, 0, 1, 8, 1, 0, 1, 3, 1, 2, 1, 0, 1, 2, 1, 4, 1, 0, 1, 2, 1, 0, 1, 0, 1, 3, 1, 0, 1, 2, 1, 4, 1, 0, 1, 2, 1, 0, 1, 5, 1, 0, 1, 2, 1, 0
Offset: 0

Views

Author

Antti Karttunen, Feb 21 2015

Keywords

Comments

The edge-relation between nodes is given by A236840(child) = parent. a(n) = 1 + the size of transitive closure of all children emanating from the parent at n. For any n in A255056 this would be infinite, thus such n are marked with zeros.
Odd numbers are leaves, as there are no such k that A236840(k) were odd, thus a(2n+1) = 1.

Crossrefs

Formula

a(2n+1) = 1, and for even numbers 2n, if A255339(n) = 1, then a(2n) = 0, otherwise, a(2n) = 1 + sum_{k = A091067(n) .. A255068(n)} a(k).

A255330 a(n) = total number of nodes in the finite subtrees branching from the node n in the infinite trunk of "number-of-runs beanstalk" (A255056).

Original entry on oeis.org

1, 2, 0, 4, 1, 0, 7, 0, 3, 1, 0, 5, 2, 6, 0, 6, 0, 3, 1, 0, 5, 2, 12, 0, 2, 5, 0, 4, 2, 6, 0, 6, 0, 3, 1, 0, 5, 2, 12, 0, 2, 7, 1, 12, 4, 0, 2, 5, 0, 4, 2, 12, 0, 2, 5, 0, 4, 2, 6, 0, 6, 0, 3, 1, 0, 5, 2, 12, 0, 2, 7, 1, 12, 4, 0, 2, 7, 1, 10, 17, 0, 0, 1, 11, 4, 0, 2, 5, 0, 4, 2, 12, 0, 2, 7, 1, 12, 4, 0, 2, 5, 0, 4, 2, 12, 0, 2, 5, 0, 4, 2, 6, 0, 6, 0, 3, 1, 0, 5
Offset: 0

Views

Author

Antti Karttunen, Feb 21 2015

Keywords

Comments

A255058 gives the number of branches (children) of the node n in the trunk, of which one is the next node of the infinite trunk itself. Thus, if A255058(n) = 1, then a(n) = 0.

Examples

			The edge-relation between nodes is given by A236840(child) = parent. Odd numbers are leaves, as there are no such k that A236840(k) were odd.
The node 11 in the infinite trunk is A255056(11) = 30. Apart from 32 [we have A236840(32) = 30] which is the next node (node 12) in the infinite trunk, it has a single leaf-child 31 [A236840(31) = 30] at the "left side" (less than 32), and a leaf-child 33 [A236840(33) = 30] (more than 32) at the "right side", and also at that side, a subtree of three nodes 34 <- 38 <- 43 [we have A236840(43) = 38, A236840(38) = 34 and A236840(34) = 30], thus in total there are 1+1+3 = 5 nodes in finite branches emanating from the node 11 of the infinite trunk, and a(11) = 5.
		

Crossrefs

Programs

Formula

a(0) = 1; a(n) = sum_{k = A091067(A255057(n)) .. A255068(A255057(n))} A255327(k).
a(n) = A255328(n) + A255329(n).

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

A255054 Run lengths in A255072.

Original entry on oeis.org

1, 2, 3, 1, 4, 3, 1, 4, 4, 4, 3, 1, 4, 4, 5, 3, 4, 4, 4, 3, 1, 4, 4, 5, 3, 7, 5, 4, 4, 4, 5, 3, 4, 4, 4, 3, 1, 4, 4, 5, 3, 7, 5, 4, 7, 6, 4, 6, 5, 4, 4, 4, 5, 3, 7, 5, 4, 4, 4, 5, 3, 4, 4, 4, 3, 1, 4, 4, 5, 3, 7, 5, 4, 7, 6, 4, 6, 5, 4, 7, 6, 7, 8, 5, 6, 6, 4, 6, 5, 4, 4, 4, 5, 3, 7, 5, 4, 7, 6, 4, 6, 5, 4, 4, 4, 5, 3, 7, 5, 4, 4, 4, 5, 3, 4, 4, 4, 3, 1, 4, 4, 5, 3, 7, 5, 4, 7, 6, 4
Offset: 0

Views

Author

Antti Karttunen, Feb 14 2015

Keywords

Comments

Number of integers k which require exactly n steps to reach 0, when starting from k and iterating the map: x -> x - (number of runs in binary representation of x).

Examples

			0 is the only number reached from 0 in zero steps, thus a(0) = 1.
Both 1 and 2, in binary '1' and '10', when the number of runs (A005811) is subtracted from them, result zero: 1-1 = 2-2 = 0, and these are only such numbers where the zero is reached with one step, thus a(1) = 2.
For 3, 4 and 5, in binary '11', '100' and '101', subtracting the number of runs results 2 in all cases, thus two steps are requires to reach zero, and as there are no other such cases, a(2) = 3.
For 6, in binary '110', subtracting A005811 repeatedly gives -> 6-2 = 4, 4-2 = 2, 2-2 = 0, three steps in total, and as 6 is the only such number requiring three steps, a(3) = 1.
		

Crossrefs

Cf. A255059 (positions of odd terms), A255060 (positions of even terms), A255061 (apart from its second term 1, gives positions of ones here).
Analogous sequences: A086876, A219644, A219654.

Formula

a(n) = A255053(n+1) - A255053(n).
a(n) = 1 + A255055(n) - A255053(n).
Other identities. For all n >= 0:
a(n) = 1 + A255123(n) + A255124(n).
Showing 1-10 of 20 results. Next