login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A274593
a(0) = 0; thereafter, a(2*n+1) = a(n)+2*n+1, otherwise a(n) = n.
1
0, 1, 2, 4, 4, 7, 6, 11, 8, 13, 10, 18, 12, 19, 14, 26, 16, 25, 18, 32, 20, 31, 22, 41, 24, 37, 26, 46, 28, 43, 30, 57, 32, 49, 34, 60, 36, 55, 38, 71, 40, 61, 42, 74, 44, 67, 46, 88, 48, 73, 50, 88, 52, 79, 54, 101, 56, 85, 58, 102
OFFSET
0,3
COMMENTS
a(n) gives the sum of the values k for which 2^j*(k+1)-1 = n (A153733(n) gives the least value of k).
In general, for i >= 2, in the sequences of type "a(0) = 0; thereafter, a(i*n+1) = a(n)+i*n+1, otherwise a(n) = n.", a(n) gives the sum of the values k for which (i^j*((i-1)*(k+1)-i+2)-1)/(i-1) = n.
LINKS
FORMULA
a(n) = (2^A001511(n+1)-1)*(2*A025480(n)+1)-A001511(n+1).
From Robert Israel, Jul 04 2016: (Start)
G.f. g(x) satisfies g(x) = x*g(x^2) + x/(1-x)^2.
a(n) = 2*n + 1 - A007814(n+1) - A000265(n+1). (End)
EXAMPLE
11 = 2^0*(11+1)-1 = 2^1*(5+1)-1 = 2^2*(2+1)-1, so a(11) = 11+5+2 = 18.
MAPLE
f:= proc(n) option remember; if n::even then n else n + procname((n-1)/2) fi end proc:
map(f, [$0..100]); # Robert Israel, Jul 04 2016
MATHEMATICA
a[0] = 0; a[n_] := a[n] = If[OddQ@ n, a[#] + 2 # + 1 &[(n - 1)/2], n]; Table[a@ n, {n, 0, 59}] (* Michael De Vlieger, Jul 04 2016 *)
PROG
(Python)
def A274593(n): return (((m:=~(n+1)&n)<<1)+1)*((n>>(k:=m.bit_length()))|1)-k-1 # Chai Wah Wu, Jul 13 2022
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Gionata Neri, Jul 03 2016
STATUS
approved