OFFSET
1,3
COMMENTS
This sequence hits every positive integer and it has a fractal-like structure, see scatterplot of 2*n-3*a(n) in Links section.
Let b(1) = b(2) = b(3) = b(4) = 1; for n >= 5, b(n) = b(t(n)) + b(n-t(n)) where t = A063882. Observe the symmetric relation between this sequence (a(n)) and b(n) thanks to plots of a(n)-2*n/3 and b(n)-n/3 in Links section. Note that a(n) + b(n) = n for n >= 2.
LINKS
FORMULA
a(n+1) - a(n) = 0 or 1 for all n >= 1.
MAPLE
b:= proc(n) option remember; `if`(n<5, 1,
b(n-b(n-1)) +b(n-b(n-4)))
end:
a:= proc(n) option remember; `if`(n<3, 1,
a(b(n)) +a(n-b(n)))
end:
seq(a(n), n=1..100); # Alois P. Heinz, Aug 05 2018
MATHEMATICA
b[n_] := b[n] = If[n < 5, 1, b[n - b[n - 1]] + b[n - b[n - 4]]];
a[n_] := a[n] = If[n < 3, 1, a[b[n]] + a[n - b[n]]];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Mar 02 2022, after Alois P. Heinz *)
PROG
(PARI) t=vector(99); t[1]=t[2]=t[3]=t[4]=1; for(n=5, #t, t[n] = t[n-t[n-1]]+t[n-t[n-4]]); a=vector(99); a[1]=a[2]=1; for(n=3, #a, a[n] = a[t[n]]+a[n-t[n]]); a
CROSSREFS
KEYWORD
nonn
AUTHOR
Altug Alkan, Aug 04 2018
STATUS
approved