login
A283833
For t >= 0, if 2^t + t - 3 <= n <= 2^t + t - 1 then a(n) = 2^t - 1, while if 2^t + t - 1 < n < 2^(t+1) + t - 3 then a(n) = 2^(t+1) + t - 2 - n.
1
1, 1, 1, 3, 3, 3, 2, 1, 7, 7, 7, 6, 5, 4, 3, 2, 1, 15, 15, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 31, 31, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 63, 63, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52
OFFSET
0,4
LINKS
J.-P. Allouche, J. Shallit, On the subword complexity of the fixed point of a -> aab, b -> b, and generalizations, arXiv preprint arXiv:1605.02361 [math.CO], 2016. See Table 3.
EXAMPLE
1,1,1;
;
3,3,3;
2,1;
7,7,7;
6,5,4,3,2,1;
15,15,15;
14,13,12,11,10,9,8,7,6,5,4,3,2,1;
31,31,31;
30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,10,9,8,7,6,5,4,3,2,1;
63,63,63;
62,61,60,59,...
MAPLE
A283833 := proc(n)
local t;
if n =0 then
return 1;
end if;
for t from 0 do
if 2^t+t-3 <= n and n<= 2^t+t-1 then
return 2^t-1 ;
elif 2^t+t-1 <= n and n<= 2^(t+1)+t-3 then
return 2^(t+1)+t-2-n ;
end if;
end do:
end proc: # R. J. Mathar, Mar 28 2017
MATHEMATICA
a[0] = 1; a[n_] := For[t = 0, True, t++, Which[2^t + t - 3 <= n && n <= 2^t + t - 1, Return[2^t - 1], 2^t + t - 1 <= n && n <= 2^(t + 1) + t - 3, Return[ 2^(t + 1) + t - 2 - n]]];
Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Dec 09 2017, from Maple *)
PROG
(PARI) a(n) = {if (n==0, return (1)); for (t=0, oo, if (((2^t+t-3) <= n) && (n <= 2^t+t-1), return (2^t-1)); if (((2^t+t-1) <= n) && (n <= 2^(t+1)+t-3), return (2^(t+1)+t-2-n)); ); } \\ Michel Marcus, Aug 21 2017
CROSSREFS
Cf. A145071.
Sequence in context: A346624 A153012 A275300 * A280759 A016651 A135877
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Mar 24 2017
STATUS
approved