OFFSET
1,2
LINKS
Lars Blomberg, Table of n, a(n) for n = 1..10000
Luke Schaeffer, Jeffrey Shallit, Closed, Palindromic, Rich, Privileged, Trapezoidal, and Balanced Words in Automatic Sequences, Electronic Journal of Combinatorics 23(1) (2016), #P1.25.
FORMULA
Th. 2 of Schaeffer-Shallit gives explicit formula.
For n >= 8 and integer k >= -1
a) if (15*2^k < n <= 18*2^k) then a(n) = 2^(k+4);
b) if (18*2^k < n <= 19*2^k) then a(n) = 2*n - 20*2^k - 2;
c) if (19*2^k < n <= 20*2^k) then a(n) = 56*2^k - 2*n + 2;
d) if (20*2^k < n <= 22*2^k) then a(n) = 4*n - 64*2^k - 4;
e) if (22*2^k < n <= 24*2^k) then a(n) = 112*2^k - 4*n + 4;
f) if (24*2^k < n <= 28*2^k) then a(n) = 2^(k+4);
g) if (28*2^k < n <= 30*2^k) then a(n) = 8*n - 208*2^k - 8;
EXAMPLE
For n=40 we must select k=1 and equation c) so a(40) = 56*2^k - 2*n + 2 = 56*2^1 - 2*40 + 2 = 34.
For n=41 we must select k=1 and equation d) so a(41) = 4*n - 64*2^k - 4 = 4*41 - 64*2^1 - 4 = 32.
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Feb 06 2016
EXTENSIONS
More terms from Lars Blomberg, Feb 09 2016
STATUS
approved