login
A305865
a(1) = 1, a(n) = -5*a(n/3) if n is divisible by 3, otherwise a(n) = n - a(n-1).
4
1, 1, -5, 9, -4, -5, 12, -4, 25, -15, 26, -45, 58, -44, 20, -4, 21, 25, -6, 26, -60, 82, -59, 20, 5, 21, -125, 153, -124, 75, -44, 76, -130, 164, -129, 225, -188, 226, -290, 330, -289, 220, -177, 221, -100, 146, -99, 20, 29, 21, -105, 157, -104, -125, 180, -124, 30, 28, 31, -130, 191, -129, 300, -236, 301, -410, 477, -409, 295
OFFSET
1,3
FORMULA
G.f. g(x) satisfies g(x) = -5*(1-x+x^2)*g(x^3) + (1+x+2*x^3-x^4)*x/(1-x^3)^2. - Robert Israel, Aug 24 2018
MAPLE
f:= proc(n) option remember;
if n mod 3 = 0 then -5*procname(n/3)
else n - procname(n-1)
fi
end proc:
f(1):= 1:
map(f, [$1..100]); # Robert Israel, Aug 24 2018
PROG
(PARI) a(n)=if(n==1, n, if(n%3==0, -5*a(n/3), n-a(n-1)));
CROSSREFS
Cf. A318265.
Sequence in context: A367606 A153356 A129956 * A342204 A010774 A272610
KEYWORD
sign,look
AUTHOR
Altug Alkan, Aug 23 2018
STATUS
approved