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!)
A320262 Write n in binary, then modify each run of 0's and each run of 1's by appending a 0. a(n) is the decimal equivalent of the result. 2

%I #21 Nov 24 2018 01:26:01

%S 2,8,6,16,34,24,14,32,66,136,70,48,98,56,30,64,130,264,134,272,546,

%T 280,142,96,194,392,198,112,226,120,62,128,258,520,262,528,1058,536,

%U 270,544,1090,2184,1094,560,1122,568,286,192,386,776,390,784,1570,792,398

%N Write n in binary, then modify each run of 0's and each run of 1's by appending a 0. a(n) is the decimal equivalent of the result.

%C A variation of A175046. Indices of record values are given by A319423.

%C From _Chai Wah Wu_, Nov 21 2018: (Start)

%C Let f(k) = Sum_{i=2^k..2^(k+1)-1} a(i), i.e., the sum ranges over all numbers with a (k+1)-bit binary expansion. Thus f(0) = a(1) = 2 and f(1) = a(2) + a(3) = 14.

%C Then f(k) = 15*6^(k-1) - 2^(k-1) for k >= 0.

%C Proof: the equation for f is true for k = 0. Looking at the last 2 bits of n, it is easy to see that a(4n) = 2*a(2n), a(4n+1) = 4*a(2n)+2, a(4n+2) = 4*a(2n+1) and a(4n+3) = 2*a(2n+1)+2. By summing over the recurrence relations for a(n), we get f(k+2) = Sum_{i=2^k..2^(k+1)-1} (f(4i) + f(4i+1) + f(4i+2) + f(4i+3)) = Sum_{i=2^k..2^(k+1)-1} (6a(2i) + 6a(2i+1) + 4) = 6*f(k+1) + 2^(k+2). Solving this first-order recurrence relation with the initial condition f(1) = 14 shows that f(k) = 15*6^(k-1) - 2^(k-1) for k > 0.

%C (End)

%H Chai Wah Wu, <a href="/A320262/b320262.txt">Table of n, a(n) for n = 1..10000</a>

%H Chai Wah Wu, <a href="https://arxiv.org/abs/1810.02293">Record values in appending and prepending bitstrings to runs of binary digits</a>, arXiv:1810.02293 [math.NT], 2018.

%F a(n) = 2*A320263(n).

%F a(4n) = 2*a(2n), a(4n+1) = 4*a(2n)+2, a(4n+2) = 4*a(2n+1) and a(4n+3) = 2*a(2n+1)+2. - _Chai Wah Wu_, Nov 21 2018

%e 6 in binary is 110. Modify each run by appending a 0 to get 11000, which is 24 in decimal. So a(6) = 24.

%t Array[FromDigits[Flatten@ Map[Append[#, 0] &, Split@ IntegerDigits[#, 2]], 2] &, 55] (* _Michael De Vlieger_, Nov 23 2018 *)

%o (Python)

%o from re import split

%o def A320262(n):

%o return int(''.join(d+'0' for d in split('(0+)|(1+)',bin(n)[2:]) if d != '' and d != None),2)

%Y Cf. A175046, A319423, A320037, A320038, A320039, A320261.

%K nonn,base

%O 1,1

%A _Chai Wah Wu_, Oct 08 2018

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 15 23:58 EDT 2024. Contains 371696 sequences. (Running on oeis4.)