|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
G.f. g(x) satisfies g(x) = x*g(x^2) + x/(1-x)^2.
|
|
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:
|
|
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
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|