cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A274593 a(0) = 0; thereafter, a(2*n+1) = a(n)+2*n+1, otherwise a(n) = n.

Original entry on oeis.org

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

Views

Author

Gionata Neri, Jul 03 2016

Keywords

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.

Examples

			11 = 2^0*(11+1)-1 = 2^1*(5+1)-1 = 2^2*(2+1)-1, so a(11) = 11+5+2 = 18.
		

Crossrefs

Programs

  • 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 *)
  • 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

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)