login
A318553
a(1) = 1, a(n) = -5*a(n/3) if n is divisible by 3, a(n) = n - a(n-1) if n + 1 is divisible by 3, otherwise a(n) = n + a(n-1).
1
1, 1, -5, -1, 6, -5, 2, 6, 25, 35, -24, 5, 18, -4, -30, -14, 31, 25, 44, -24, -10, 12, 11, -30, -5, 31, -125, -97, 126, -175, -144, 176, 120, 154, -119, -25, 12, 26, -90, -50, 91, 20, 63, -19, 150, 196, -149, 70, 119, -69, -155, -103, 156, -125, -70, 126, -220, -162, 221, 120, 181, -119, 50, 114, -49, -60, 7, 61
OFFSET
1,3
MATHEMATICA
a[1]=1; a[n_] := a[n] = Switch[Mod[n, 3], 0, -5 a[n/3], 1, n + a[n-1], 2, n - a[n-1]]; Array[a, 68] (* Giovanni Resta, Sep 05 2018 *)
PROG
(PARI) a = vector(99); for(n=1, #a, print1 (a[n]=if(n<=1, 1, if (n%3==0, -5*a[n/3], if(n%3==1, n+a[n-1], n-a[n-1])))", "));
(PARI) a(n) = if(n==1, 1, if(n%3==0, -5*a(n/3), if(n%3==1, n+a(n-1), n-a(n-1))))
CROSSREFS
Cf. A305865.
Sequence in context: A343344 A200644 A318265 * A176909 A131944 A228475
KEYWORD
sign,look
AUTHOR
Altug Alkan, Aug 28 2018
STATUS
approved