[go: up one dir, main page]

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”).

A105670
a(1)=1 then bracketing n by powers of 2 as f(t)=2^t for f(t) < n <= f(t+1), a(n) = f(t+1) - a(n-f(t)).
5
1, 1, 3, 3, 7, 7, 5, 5, 15, 15, 13, 13, 9, 9, 11, 11, 31, 31, 29, 29, 25, 25, 27, 27, 17, 17, 19, 19, 23, 23, 21, 21, 63, 63, 61, 61, 57, 57, 59, 59, 49, 49, 51, 51, 55, 55, 53, 53, 33, 33, 35, 35, 39, 39, 37, 37, 47, 47, 45, 45, 41, 41, 43, 43, 127, 127, 125, 125, 121, 121, 123
OFFSET
1,3
LINKS
FORMULA
a(2n-1) = a(2n).
a(n) = 2*a(ceiling(n/2)) -1 + 2*t(ceiling(n/2)-1) where t(n) = A010060(n) is the Thue-Morse sequence.
MAPLE
A062383 := proc(n)
ceil(log(n)/log(2)) ;
2^% ;
end proc:
A105670 := proc(n)
option remember;
if n = 1 then
1;
else
fn1 := A062383(n) ;
fn := fn1/2 ;
fn1-procname(n-fn) ;
end if;
end proc:
seq(A105670(n), n=1..80) ; # R. J. Mathar, Nov 06 2011
MATHEMATICA
t[0] = 0; t[1] = 1; t[n_?EvenQ] := t[n] = t[n/2]; t[n_?OddQ] := t[n] = 1 - t[(n-1)/2]; a[1] = 1; a[n_?EvenQ] := a[n] = a[n - 1]; a[n_] := a[n] = 2*a[Ceiling[n/2]] - 1 + 2*t[Ceiling[n/2] - 1]; Table[a[n], {n, 1, 71}] (* Jean-François Alcover, Aug 13 2013 *)
PROG
(PARI) b(n, m)=if(n<2, 1, m*m^floor(log(n-1)/log(m))-b(n-m^floor(log(n-1)/log(m)), m))
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, May 03 2005
EXTENSIONS
Typo in data corrected by Jean-François Alcover, Aug 13 2013
STATUS
approved