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!)
A341915 For any nonnegative number n with runs in binary expansion (r_1, ..., r_w), a(n) = Sum_{k = 1..w} 2^(r_1 + ... + r_k - 1). 4

%I #19 Jan 02 2022 07:25:45

%S 0,1,3,2,5,7,6,4,9,13,15,11,10,14,12,8,17,25,29,21,23,31,27,19,18,26,

%T 30,22,20,28,24,16,33,49,57,41,45,61,53,37,39,55,63,47,43,59,51,35,34,

%U 50,58,42,46,62,54,38,36,52,60,44,40,56,48,32,65,97,113

%N For any nonnegative number n with runs in binary expansion (r_1, ..., r_w), a(n) = Sum_{k = 1..w} 2^(r_1 + ... + r_k - 1).

%C This sequence is a permutation of the nonnegative integers with inverse A341916.

%C This sequence has connections with A003188; here we compute partials sums of runs from left to right, there from right to left.

%H Rémy Sigrist, <a href="/A341915/b341915.txt">Table of n, a(n) for n = 0..8191</a>

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

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%F a(n) = A059893(A003188(n)).

%F a(n) = Sum_{k = 1..A005811(n)} 2^((Sum_{m = 1..k} A101211(m))-1).

%F a(n) < 2^k for any n < 2^k.

%F A000120(a(n)) = A000120(A003188(n)) = A005811(n).

%e For n = 23,

%e - the binary representation of 23 is "10111",

%e - the corresponding run lengths are (1, 1, 3),

%e - so a(23) = 2^(1-1) + 2^(1+1-1) + 2^(1+1+3-1) = 19.

%t a[n_] := If[n == 0, 0, 2^((Length /@ Split[IntegerDigits[n, 2]] // Accumulate)-1) // Total];

%t Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, Jan 02 2022 *)

%o (PARI) a(n) = { my (v=0); while (n, my (w=valuation(n+n%2,2)); n\=2^w; v=2^w*(1+v)); v/2 }

%Y Cf. A003188, A005811, A059893, A101211, A341916 (inverse), A341943 (fixed points).

%K nonn,look,base

%O 0,3

%A _Rémy Sigrist_, Feb 23 2021

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 23 10:29 EDT 2024. Contains 371905 sequences. (Running on oeis4.)