login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A233272 a(n) = n + 1 + number of nonleading zeros in binary representation of n (A080791). 9

%I #25 Mar 01 2024 11:48:22

%S 1,2,4,4,7,7,8,8,12,12,13,13,15,15,16,16,21,21,22,22,24,24,25,25,28,

%T 28,29,29,31,31,32,32,38,38,39,39,41,41,42,42,45,45,46,46,48,48,49,49,

%U 53,53,54,54,56,56,57,57,60,60,61,61,63,63,64,64,71,71,72

%N a(n) = n + 1 + number of nonleading zeros in binary representation of n (A080791).

%C From _Antti Karttunen_, Jan 30 2022: (Start)

%C Write n in binary: 1ab..xyz, then a(n) = (1+1ab..xy) + (1+1ab..x) + ... + (1+1ab) + (1+1a) + (1+1) + (1+0) + 1. This method was found by LODA miner, see the assembly program at C. Krause link.

%C Proof: Compare to a similar formula given for A011371, with a(n) = a(floor(n/2)) + floor(n/2) to the new formula for this sequence which is a(n) = 1 + a(floor(n/2)) + floor(n/2), for n > 0 and a(0) = 1. It is easy to see that the difference between these, a(n) - A011371(n) = 1+A070939(n), for n > 0. As A011371(n) = n minus (number of 1's in binary expansion of n), then a(n) = 1 + (number of digits in binary expansion of n) + (n minus number of 1's in binary expansion of n) = 1 + n + (number of nonleading 0's in binary expansion of n), which indeed is the definition of this sequence.

%C (End)

%H Antti Karttunen, <a href="/A233272/b233272.txt">Table of n, a(n) for n = 0..8192</a>

%H Christian Krause, et al, <a href="https://github.com/loda-lang/loda-programs/blob/main/oeis/233/A233272.asm">A mined LODA assembly source for this sequence</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F a(n) = n + A080791(n) + 1.

%F For all n>=1, a(n) = n + A000120(A054429(n)).

%F a(0) = 1; for n > 1, a(n) = 1 + floor(n/2) + a(floor(n/2)). - (Found by LODA miner, see comments) - _Antti Karttunen_, Jan 30 2022

%t DigitCount[#, 2, 0] + # + 1 & [Range[0, 100]] (* _Paolo Xausa_, Mar 01 2024 *)

%o (PARI) A233272(n) = { my(s=1); while(n, n>>=1; s+=(1+n)); (s); }; \\ (After a LODA-assembly program found by a miner) - _Antti Karttunen_, Jan 30 2022

%o (Scheme)

%o (define (A233272 n) (+ 1 n (A080791 n)))

%o ;; Alternatively:

%o (define (A233272 n) (if (zero? n) 1 (+ n (A000120 (A054429 n)))))

%Y Bisection: A233273 (A120511 + 1). Iterates: A233271, A216431.

%Y Cf. A000120, A005187, A011371, A054429, A070939, A080791, A092391.

%K nonn,base

%O 0,2

%A _Antti Karttunen_, Dec 12 2013

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 09:23 EDT 2024. Contains 371782 sequences. (Running on oeis4.)