OFFSET
1,1
COMMENTS
If n=3k+1 or 3k+2, abs(r(x))=n for x=4k+4 and x=8k+1 (first solution only is in the sequence). This was inspired by Recamán's sequence (A005132).
FORMULA
For k >= 1, a(3k+1) = a(3k+2) = 4k+4;
for m >= 2, k >= 1, a(3^m*k) = 3^(m-2)*28*k+1.
For a(3^m*k+a) it is more complicated to give a general formula, as examples: a(9k+3) = 28k+9; a(9k+6) = 36k+25; a(27k+3) = 84k+9; a(27k+6) = 104k+25; a(27k+9) = 84k+29; a(27k+12) = 84k+37; a(27k+24) = 136k+129.
Sum_{k=1..n} a(k) is asymptotic to n^2.
EXAMPLE
If r(1)=5: r(8)=5, hence a(5)=8.
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Oct 31 2002
STATUS
approved