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.

A277009 Numbers not in range of A277012: numbers such that at least one run of 1-bits in their binary expansion is longer than 1 + the total number of 0-bits anywhere right of that run.

Original entry on oeis.org

3, 7, 11, 14, 15, 19, 23, 27, 29, 30, 31, 35, 39, 43, 46, 47, 51, 55, 59, 60, 61, 62, 63, 67, 71, 75, 78, 79, 83, 87, 91, 93, 94, 95, 99, 103, 107, 110, 111, 115, 119, 121, 122, 123, 124, 125, 126, 127, 131, 135, 139, 142, 143, 147, 151, 155, 157, 158, 159, 163, 167, 171, 174, 175, 179, 183, 187, 188, 189, 190, 191, 195, 199, 203
Offset: 1

Views

Author

Antti Karttunen, Sep 25 2016

Keywords

Comments

Numbers n for which A277007(n) > 0.
Numbers n for which A276077(A005940(1+n)) > 0.

Examples

			3 ("11" in binary, A007088) is present as the length of that only run of 1's is 2, and 2 > 1+0, where 0 is the total number of 0's to the right of that run.
60 ("111100" in binary) is present as 4 > 2+1.
246 ("11110110" in binary) is present as the length of the leftmost run of 1-bits is 4, and 4 > 1+2, where 2 is the total number of 0's located anywhere to the right of that run.
		

Crossrefs

Complement: A277008.
Positions of nonzeros in A277007. Numbers not present in A277012.
Differs from its subsequence A277019 for the first time at n=20, where a(20)=60, a term not present in A277019.

A277011 Left inverse of A277012.

Original entry on oeis.org

0, 1, 2, 2, 6, 3, 4, 3, 24, 7, 8, 4, 12, 5, 6, 4, 120, 25, 26, 8, 30, 9, 10, 5, 48, 13, 14, 6, 18, 7, 8, 5, 720, 121, 122, 26, 126, 27, 28, 9, 144, 31, 32, 10, 36, 11, 12, 6, 240, 49, 50, 14, 54, 15, 16, 7, 72, 19, 20, 8, 24, 9, 10, 6, 5040, 721, 722, 122, 726, 123, 124, 27, 744, 127, 128, 28, 132, 29, 30, 10, 840, 145, 146, 32
Offset: 0

Views

Author

Antti Karttunen, Sep 25 2016

Keywords

Crossrefs

Left inverse of A277012.
Cf. also A277007.

Programs

  • Scheme
    ;; Standalone iterative implementation:
    (define (A277011 n) (let loop ((s 0) (n n) (r 0) (i 2) (f 1)) (cond ((zero? n) (+ s (* r f))) ((even? n) (loop (+ s (* r f)) (/ n 2) 0 (+ 1 i) (* i f))) (else (loop s (/ (- n 1) 2) (+ 1 r) i f)))))

Formula

a(n) = A276075(A005940(1+n)).
For all n >= 0, a(A277012(n)) = n.

A156552 Unary-encoded compressed factorization of natural numbers.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 8, 7, 6, 9, 16, 11, 32, 17, 10, 15, 64, 13, 128, 19, 18, 33, 256, 23, 12, 65, 14, 35, 512, 21, 1024, 31, 34, 129, 20, 27, 2048, 257, 66, 39, 4096, 37, 8192, 67, 22, 513, 16384, 47, 24, 25, 130, 131, 32768, 29, 36, 71, 258, 1025, 65536, 43, 131072, 2049, 38, 63, 68, 69, 262144
Offset: 1

Views

Author

Leonid Broukhis, Feb 09 2009

Keywords

Comments

The primes become the powers of 2 (2 -> 1, 3 -> 2, 5 -> 4, 7 -> 8); the composite numbers are formed by taking the values for the factors in the increasing order, multiplying them by the consecutive powers of 2, and summing. See the Example section.
From Antti Karttunen, Jun 27 2014: (Start)
The odd bisection (containing even terms) halved gives A244153.
The even bisection (containing odd terms), when one is subtracted from each and halved, gives this sequence back.
(End)
Question: Are there any other solutions that would satisfy the recurrence r(1) = 0; and for n > 1, r(n) = Sum_{d|n, d>1} 2^A033265(r(d)), apart from simple variants 2^k * A156552(n)? See also A297112, A297113. - Antti Karttunen, Dec 30 2017

Examples

			For 84 = 2*2*3*7 -> 1*1 + 1*2 + 2*4 + 8*8 =  75.
For 105 = 3*5*7 -> 2*1 + 4*2 + 8*4 = 42.
For 137 = p_33 -> 2^32 = 4294967296.
For 420 = 2*2*3*5*7 -> 1*1 + 1*2 + 2*4 + 4*8 + 8*16 = 171.
For 147 = 3*7*7 = p_2 * p_4 * p_4 -> 2*1 + 8*2 + 8*4 = 50.
		

Crossrefs

One less than A005941.
Inverse permutation: A005940 with starting offset 0 instead of 1.
Cf. also A297106, A297112 (Möbius transform), A297113, A153013, A290308, A300827, A323243, A323244, A323247, A324201, A324812 (n for which a(n) is a square), A324813, A324822, A324823, A324398, A324713, A324815, A324819, A324865, A324866, A324867.

Programs

  • Mathematica
    Table[Floor@ Total@ Flatten@ MapIndexed[#1 2^(#2 - 1) &, Flatten[ Table[2^(PrimePi@ #1 - 1), {#2}] & @@@ FactorInteger@ n]], {n, 67}] (* Michael De Vlieger, Sep 08 2016 *)
  • PARI
    a(n) = {my(f = factor(n), p2 = 1, res = 0); for(i = 1, #f~, p = 1 << (primepi(f[i, 1]) - 1); res += (p * p2 * (2^(f[i, 2]) - 1)); p2 <<= f[i, 2]); res}; \\ David A. Corneth, Mar 08 2019
    
  • PARI
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A156552(n) = if(1==n, 0, if(!(n%2), 1+(2*A156552(n/2)), 2*A156552(A064989(n)))); \\ (based on the given recurrence) - Antti Karttunen, Mar 08 2019
    
  • Perl
    # Program corrected per instructions from Leonid Broukhis. - Antti Karttunen, Jun 26 2014
    # However, it gives correct answers only up to n=136, before corruption by a wrap-around effect.
    # Note that the correct answer for n=137 is A156552(137) = 4294967296.
    $max = $ARGV[0];
    $pow = 0;
    foreach $i (2..$max) {
    @a = split(/ /, `factor $i`);
    shift @a;
    $shift = 0;
    $cur = 0;
    while ($n = int shift @a) {
    $prime{$n} = 1 << $pow++ if !defined($prime{$n});
    $cur |= $prime{$n} << $shift++;
    }
    print "$cur, ";
    }
    print "\n";
    (Scheme, with memoization-macro definec from Antti Karttunen's IntSeq-library, two different implementations)
    (definec (A156552 n) (cond ((= n 1) 0) (else (+ (A000079 (+ -2 (A001222 n) (A061395 n))) (A156552 (A052126 n))))))
    (definec (A156552 n) (cond ((= 1 n) (- n 1)) ((even? n) (+ 1 (* 2 (A156552 (/ n 2))))) (else (* 2 (A156552 (A064989 n))))))
    ;; Antti Karttunen, Jun 26 2014
    
  • Python
    from sympy import primepi, factorint
    def A156552(n): return sum((1<Chai Wah Wu, Mar 10 2023

Formula

From Antti Karttunen, Jun 26 2014: (Start)
a(1) = 0, a(n) = A000079(A001222(n)+A061395(n)-2) + a(A052126(n)).
a(1) = 0, a(2n) = 1+2*a(n), a(2n+1) = 2*a(A064989(2n+1)). [Compare to the entanglement recurrence A243071].
For n >= 0, a(2n+1) = 2*A244153(n+1). [Follows from the latter clause of the above formula.]
a(n) = A005941(n) - 1.
As a composition of related permutations:
a(n) = A003188(A243354(n)).
a(n) = A054429(A243071(n)).
For all n >= 1, A005940(1+a(n)) = n and for all n >= 0, a(A005940(n+1)) = n. [The offset-0 version of A005940 works as an inverse for this permutation.]
This permutations also maps between the partition-lists A112798 and A125106:
A056239(n) = A161511(a(n)). [The sums of parts of each partition (the total sizes).]
A003963(n) = A243499(a(n)). [And also the products of those parts.]
(End)
From Antti Karttunen, Oct 09 2016: (Start)
A161511(a(n)) = A056239(n).
A029837(1+a(n)) = A252464(n). [Binary width of terms.]
A080791(a(n)) = A252735(n). [Number of nonleading 0-bits.]
A000120(a(n)) = A001222(n). [Binary weight.]
For all n >= 2, A001511(a(n)) = A055396(n).
For all n >= 2, A000120(a(n))-1 = A252736(n). [Binary weight minus one.]
A252750(a(n)) = A252748(n).
a(A250246(n)) = A252754(n).
a(A005117(n)) = A277010(n). [Maps squarefree numbers to a permutation of A003714, fibbinary numbers.]
A085357(a(n)) = A008966(n). [Ditto for their characteristic functions.]
For all n >= 0:
a(A276076(n)) = A277012(n).
a(A276086(n)) = A277022(n).
a(A260443(n)) = A277020(n).
(End)
From Antti Karttunen, Dec 30 2017: (Start)
For n > 1, a(n) = Sum_{d|n, d>1} 2^A033265(a(d)). [See comments.]
More linking formulas:
A106737(a(n)) = A000005(n).
A290077(a(n)) = A000010(n).
A069010(a(n)) = A001221(n).
A136277(a(n)) = A181591(n).
A132971(a(n)) = A008683(n).
A106400(a(n)) = A008836(n).
A268411(a(n)) = A092248(n).
A037011(a(n)) = A010052(n) [conjectured, depends on the exact definition of A037011].
A278161(a(n)) = A046951(n).
A001316(a(n)) = A061142(n).
A277561(a(n)) = A034444(n).
A286575(a(n)) = A037445(n).
A246029(a(n)) = A181819(n).
A278159(a(n)) = A124859(n).
A246660(a(n)) = A112624(n).
A246596(a(n)) = A069739(n).
A295896(a(n)) = A053866(n).
A295875(a(n)) = A295297(n).
A284569(a(n)) = A072411(n).
A286574(a(n)) = A064547(n).
A048735(a(n)) = A292380(n).
A292272(a(n)) = A292382(n).
A244154(a(n)) = A048673(n), a(A064216(n)) = A244153(n).
A279344(a(n)) = A279339(n), a(A279338(n)) = A279343(n).
a(A277324(n)) = A277189(n).
A037800(a(n)) = A297155(n).
For n > 1, A033265(a(n)) = 1+A297113(n).
(End)
From Antti Karttunen, Mar 08 2019: (Start)
a(n) = A048675(n) + A323905(n).
a(A324201(n)) = A000396(n), provided there are no odd perfect numbers.
The following sequences are derived from or related to the base-2 expansion of a(n):
A000265(a(n)) = A322993(n).
A002487(a(n)) = A323902(n).
A005187(a(n)) = A323247(n).
A324288(a(n)) = A324116(n).
A323505(a(n)) = A323508(n).
A079559(a(n)) = A323512(n).
A085405(a(n)) = A323239(n).
The following sequences are obtained by applying to a(n) a function that depends on the prime factorization of its argument, which goes "against the grain" because a(n) is the binary code of the factorization of n, which in these cases is then factored again:
A000203(a(n)) = A323243(n).
A033879(a(n)) = A323244(n) = 2*a(n) - A323243(n),
A294898(a(n)) = A323248(n).
A000005(a(n)) = A324105(n).
A000010(a(n)) = A324104(n).
A083254(a(n)) = A324103(n).
A001227(a(n)) = A324117(n).
A000593(a(n)) = A324118(n).
A001221(a(n)) = A324119(n).
A009194(a(n)) = A324396(n).
A318458(a(n)) = A324398(n).
A192895(a(n)) = A324100(n).
A106315(a(n)) = A324051(n).
A010052(a(n)) = A324822(n).
A053866(a(n)) = A324823(n).
A001065(a(n)) = A324865(n) = A323243(n) - a(n),
A318456(a(n)) = A324866(n) = A324865(n) OR a(n),
A318457(a(n)) = A324867(n) = A324865(n) XOR a(n),
A318458(a(n)) = A324398(n) = A324865(n) AND a(n),
A318466(a(n)) = A324819(n) = A323243(n) OR 2*a(n),
A318467(a(n)) = A324713(n) = A323243(n) XOR 2*a(n),
A318468(a(n)) = A324815(n) = A323243(n) AND 2*a(n).
(End)

Extensions

More terms from Antti Karttunen, Jun 28 2014

A060130 Number of nonzero digits in factorial base representation (A007623) of n; minimum number of transpositions needed to compose each permutation in the lists A060117 & A060118.

Original entry on oeis.org

0, 1, 1, 2, 1, 2, 1, 2, 2, 3, 2, 3, 1, 2, 2, 3, 2, 3, 1, 2, 2, 3, 2, 3, 1, 2, 2, 3, 2, 3, 2, 3, 3, 4, 3, 4, 2, 3, 3, 4, 3, 4, 2, 3, 3, 4, 3, 4, 1, 2, 2, 3, 2, 3, 2, 3, 3, 4, 3, 4, 2, 3, 3, 4, 3, 4, 2, 3, 3, 4, 3, 4, 1, 2, 2, 3, 2, 3, 2, 3, 3, 4, 3, 4, 2, 3, 3, 4, 3, 4, 2, 3, 3, 4, 3, 4, 1, 2, 2, 3, 2, 3, 2, 3, 3
Offset: 0

Views

Author

Antti Karttunen, Mar 02 2001

Keywords

Examples

			19 = 3*(3!) + 0*(2!) + 1*(1!), thus it is written as "301" in factorial base (A007623). The count of nonzero digits in that representation is 2, so a(19) = 2.
		

Crossrefs

Cf. A227130 (positions of even terms), A227132 (of odd terms).
The topmost row and the leftmost column in array A230415, the left edge of triangle A230417.
Differs from similar A267263 for the first time at n=30.

Programs

  • Maple
    A060130(n) = count_nonfixed(convert(PermUnrank3R(n), 'disjcyc'))-nops(convert(PermUnrank3R(n), 'disjcyc')) or nops(fac_base(n))-nops(positions(0, fac_base(n)))
    fac_base := n -> fac_base_aux(n, 2); fac_base_aux := proc(n, i) if(0 = n) then RETURN([]); else RETURN([op(fac_base_aux(floor(n/i), i+1)), (n mod i)]); fi; end;
    count_nonfixed := l -> convert(map(nops, l), `+`);
    positions := proc(e, ll) local a, k, l, m; l := ll; m := 1; a := []; while(member(e, l[m..nops(l)], 'k')) do a := [op(a), (k+m-1)]; m := k+m; od; RETURN(a); end;
    # For procedure PermUnrank3R see A060117
  • Mathematica
    Block[{nn = 105, r}, r = MixedRadix[Reverse@ Range[2, -1 + SelectFirst[Range@ 12, #! > nn &]]]; Array[Count[IntegerDigits[#, r], k_ /; k > 0] &, nn, 0]] (* Michael De Vlieger, Dec 30 2017 *)
  • Scheme
    (define (A060130 n) (let loop ((n n) (i 2) (s 0)) (cond ((zero? n) s) (else (loop (quotient n i) (+ 1 i) (+ s (if (zero? (remainder n i)) 0 1)))))))
    ;; Two other implementations, that use memoization-macro definec:
    (definec (A060130 n) (if (zero? n) n (+ 1 (A060130 (A257687 n)))))
    (definec (A060130 n) (if (zero? n) n (+ (A257511 n) (A060130 (A257684 n)))))
    ;; Antti Karttunen, Dec 30 2017

Formula

a(0) = 0; for n > 0, a(n) = 1 + a(A257687(n)).
a(0) = 0; for n > 0, a(n) = A257511(n) + a(A257684(n)).
a(n) = A060129(n) - A060128(n).
a(n) = A084558(n) - A257510(n).
a(n) = A275946(n) + A275962(n).
a(n) = A275948(n) + A275964(n).
a(n) = A055091(A060119(n)).
a(n) = A069010(A277012(n)) = A000120(A275727(n)).
a(n) = A001221(A275733(n)) = A001222(A275733(n)).
a(n) = A001222(A275734(n)) = A001222(A275735(n)) = A001221(A276076(n)).
a(n) = A046660(A275725(n)).
a(A225901(n)) = a(n).
A257511(n) <= a(n) <= A034968(n).
A275806(n) <= a(n).
a(A275804(n)) = A060502(A275804(n)). [A275804 gives all the positions where this coincides with A060502.]
a(A276091(n)) = A260736(A276091(n)). [A276091 gives all the positions where this coincides with A260736.]

Extensions

Example-section added, name edited, the old Maple-code moved away from the formula-section, and replaced with all the new formulas by Antti Karttunen, Dec 30 2017

A277020 Unary-binary representation of Stern polynomials: a(n) = A156552(A260443(n)).

Original entry on oeis.org

0, 1, 2, 5, 4, 13, 10, 21, 8, 45, 26, 93, 20, 109, 42, 85, 16, 173, 90, 477, 52, 957, 186, 733, 40, 749, 218, 1501, 84, 877, 170, 341, 32, 685, 346, 3549, 180, 12221, 954, 7133, 104, 14269, 1914, 49021, 372, 28605, 1466, 5853, 80, 5869, 1498, 30685, 436, 61373, 3002, 23517, 168, 12013, 1754, 24029, 340, 7021, 682, 1365
Offset: 0

Views

Author

Antti Karttunen, Oct 07 2016

Keywords

Comments

Sequence encodes Stern polynomials (see A125184, A260443) with "unary-binary method" where any nonzero coefficient c > 0 is encoded as a run of c 1-bits, separated from neighboring 1-runs by exactly one zero (this follows because A260442 is a subsequence of A073491). See the examples.
Terms which are not multiples of 4 form a subset of A003754, or in other words, each term is 2^k * {a term from a certain subsequence of A247648}, which subsequence remains to be determined.

Examples

			n    Stern polynomial       Encoded as              a(n)
                            "unary-binary" number   (-> decimal)
----------------------------------------------------------------
0    B_0(x) = 0                     "0"               0
1    B_1(x) = 1                     "1"               1
2    B_2(x) = x                    "10"               2
3    B_3(x) = x + 1               "101"               5
4    B_4(x) = x^2                 "100"               4
5    B_5(x) = 2x + 1             "1101"              13
6    B_6(x) = x^2 + x            "1010"              10
7    B_7(x) = x^2 + x + 1       "10101"              21
8    B_8(x) = x^3                "1000"               8
9    B_9(x) = x^2 + 2x + 1     "101101"              45
		

Crossrefs

Cf. A087808 (a left inverse), A156552, A260443, A277189 (odd bisection).

Programs

  • Scheme
    (define (A277020 n) (A156552 (A260443 n)))
    ;; Another implementation, more practical to run:
    (define (A277020 n) (list_of_numbers_to_unary_binary_representation (A260443as_index_lists n)))
    (definec (A260443as_index_lists n) (cond ((zero? n) (list)) ((= 1 n) (list 1)) ((even? n) (cons 0 (A260443as_index_lists (/ n 2)))) (else (add_two_lists (A260443as_index_lists (/ (- n 1) 2)) (A260443as_index_lists (/ (+ n 1) 2))))))
    (define (add_two_lists nums1 nums2) (let ((len1 (length nums1)) (len2 (length nums2))) (cond ((< len1 len2) (add_two_lists nums2 nums1)) (else (map + nums1 (append nums2 (make-list (- len1 len2) 0)))))))
    (define (list_of_numbers_to_unary_binary_representation nums) (let loop ((s 0) (nums nums) (b 1)) (cond ((null? nums) s) (else (loop (+ s (* (A000225 (car nums)) b)) (cdr nums) (* (A000079 (+ 1 (car nums))) b))))))

Formula

a(n) = A156552(A260443(n)).
Other identities. For all n >= 0:
A087808(a(n)) = n.
A000120(a(n)) = A002487(n).
a(2n) = 2*a(n).
a(2^n) = 2^n.
a(A000225(n)) = A002450(n).

A277022 Primorial base representation of n is rewritten as a base-2 number with each nonzero digit k replaced by a run of k 1's (followed by one extra zero if not the rightmost run of 1's) and with each 0 kept as 0.

Original entry on oeis.org

0, 1, 2, 5, 6, 13, 4, 9, 10, 21, 22, 45, 12, 25, 26, 53, 54, 109, 28, 57, 58, 117, 118, 237, 60, 121, 122, 245, 246, 493, 8, 17, 18, 37, 38, 77, 20, 41, 42, 85, 86, 173, 44, 89, 90, 181, 182, 365, 92, 185, 186, 373, 374, 749, 188, 377, 378, 757, 758, 1517, 24, 49, 50, 101, 102, 205, 52, 105, 106, 213, 214, 429, 108, 217, 218, 437, 438, 877, 220
Offset: 0

Views

Author

Antti Karttunen, Sep 26 2016

Keywords

Examples

			9 = "111" in primorial base (A002110(0) + A002110(1) + A002110(2) = 9) is converted to three 1-bits, with separating zeros, in binary as "10101" = A007088(21), thus a(9) = 21.
91 = "3001" in primorial base (91 = 3*A002110(3) + A002110(0)) is converted to binary number "1110001" = A007088(113), thus a(91) = 113. Note how two of the zeros come from the primorial base representation and the third zero is an extra separating zero inserted after each run of 1-bits apart from the rightmost 1-run.
120 = "4000" in primorial base (120 = 4*A002110(3)) is converted to the binary number "1111000" = A007088(120), thus a(120) = 120.
		

Crossrefs

Cf. A277018 (terms sorted into ascending order).
Cf. A277021 (a left inverse).
Differs from analogous A277012 for the first time at n=24, where a(24) = 60, while A277012(24) = 8.

Formula

a(0) = 0; for n >= 1, a(n) = A000225(A276088(n))*A000079(A276084(n)) + A000079(A276088(n))*a(A276093(n)).
a(n) = A156552(A276086(n)).
Other identities. For all n >= 0:
A277021(a(n)) = n.
A005940(1+a(n)) = A276086(n).
A000035(a(n)) = A000035(n). [Preserves the parity of n.]
A000120(a(n)) = A276150(n).
A069010(a(n)) = A267263(n).

A277007 Number of maximal runs of 1-bits (in binary expansion of n) such that the length of run > 1 + the total number of zeros anywhere right of that run.

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0
Offset: 0

Views

Author

Antti Karttunen, Sep 25 2016

Keywords

Examples

			For n=3, "11" in binary, the only maximal run of 1-bits is of length 2, and 2 > 0+1 (where 0 is the total number of zeros to the right of it), thus a(3) = 1.
For n=59, "111011" in binary, both the length of run "11" at the least significant end exceeds the limit (see case n=3 above), and also the length of run "111" exceeds 1 + the total number of 0's to the right of it, thus a(59) = 1+1 = 2.
For n=60, "111100" in binary, the length of only run of 1's is 4, and 4 > 2+1, thus a(60) = 1.
For n=118, "1110110" in binary, the length of rightmost run of 1-bits is 2, but that is not > 1+1 (one more than the number of 0-bits right to it). Also, the length of the leftmost run of 1-bits is 3, but that is not > 1+2, thus a(118) = 0.
For n=246, "11110110" in binary, the rightmost run of 1-bits does not contribute, but the leftmost run of 1-bits has now length 4, which is more than 1+2 (where 2 is the total number of 0-bits right of it), thus a(246) = 1.
		

Crossrefs

Cf. A277008 (positions of zeros), A277009 (of nonzeros).
Differs from the similar entry A277017 for the first time at n=60, where a(60)=1, while A277017(60)=0.

Programs

  • Scheme
    ;; Standalone iterative implementation:
    (define (A277007 n) (let loop ((e 0) (n n) (z 0) (r 0)) (cond ((zero? n) (+ e (if (> r (+ 1 z)) 1 0))) ((even? n) (loop (+ e (if (> r (+ 1 z)) 1 0)) (/ n 2) (+ 1 z) 0)) (else (loop e (/ (- n 1) 2) z (+ 1 r))))))

Formula

a(n) = A276077(A005940(1+n)).

A277008 Numbers k such that in the binary expansion of k no run of 1-bits is longer than 1 + the total number of 0-bits anywhere to the right of that run.

Original entry on oeis.org

0, 1, 2, 4, 5, 6, 8, 9, 10, 12, 13, 16, 17, 18, 20, 21, 22, 24, 25, 26, 28, 32, 33, 34, 36, 37, 38, 40, 41, 42, 44, 45, 48, 49, 50, 52, 53, 54, 56, 57, 58, 64, 65, 66, 68, 69, 70, 72, 73, 74, 76, 77, 80, 81, 82, 84, 85, 86, 88, 89, 90, 92, 96, 97, 98, 100, 101, 102, 104, 105, 106, 108, 109, 112, 113, 114, 116, 117, 118, 120, 128
Offset: 0

Views

Author

Antti Karttunen, Sep 25 2016

Keywords

Comments

Numbers k for which A277007(k) = 0.
Indexing starts from zero as a(0) = 0 is a special case in this sequence.

Crossrefs

Complement: A277009.
Positions of zeros in A277007.
Sequence A277012 sorted into ascending order.
Subsequence of A277018 from which this differs for the first time at n=41, where a(41)=64, skipping the value 60 present in A277018.

Programs

Formula

Other identitities:
A276077(A005940(1+a(n))) = 0 for all n.
Showing 1-8 of 8 results.