OFFSET
2,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 2..10000
MATHEMATICA
PROG
(Magma)
nmax:=200;
h:=[n le 2 select 1 else Self(Self(n-1)) + Self(n - Self(n-1)): n in [1..10*nmax]]; // h = A004001
A188163:= function(n)
for j in [1..8*nmax+1] do
if h[j] eq n then return j; end if;
end for;
end function;
// define a sequence based on A188163
p:= func< n | A188163(n) + 1 - 0^(n-1) >;
A209247:= function(n)
if n le 2 then return 1;
else return p(p(n)) + p(p(Abs(n - p(p(n-1)))));
end if;
end function;
[A209247(n): n in [2..nmax]]; // G. C. Greubel, May 20 2024
(SageMath)
@CachedFunction
def h(n): return 1 if (n<3) else h(h(n-1)) + h(n - h(n-1)) # h=A004001
def A188163(n):
for j in range(1, 2*n+1):
if h(j)==n: return j
# define a function based on A188163
def p(n): return A188163(n) + 1 - int(n==1)
@CachedFunction
def A209247(n): return 1 if (n<3) else p(p(n)) + p(p(abs(n - p(p(n-1)))))
[A209247(n) for n in range(2, 201)] # G. C. Greubel, May 20 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Roger L. Bagula, Jan 13 2013
EXTENSIONS
Edited by G. C. Greubel, Apr 23 2024
STATUS
approved