login
A351466
a(n) = (a(n-1) + a(n-3))/2 if (a(n-1)+a(n-3)) is even. Otherwise, a(n)=a(n-1)+a(n-3).
1
1, 2, 1, 1, 3, 2, 3, 3, 5, 4, 7, 6, 5, 6, 6, 11, 17, 23, 17, 17, 20, 37, 27, 47, 42, 69, 58, 50, 119, 177, 227, 173, 175, 201, 187, 181, 191, 189, 185, 188, 377, 281, 469, 423, 352, 821, 622, 487, 654, 638, 1125, 1779, 2417, 1771, 1775, 2096, 3867, 2821, 4917, 4392, 7213, 6065, 10457
OFFSET
1,2
LINKS
MAPLE
A351466 := proc(n)
option remember ;
local a;
if n <= 2 then
n;
else
a := procname(n-1)+procname(n-3) ;
if type(a, 'even') then
a/2 ;
else
a ;
end if;
end if;
end proc:
seq(A351466(n), n=1..100) ; # R. J. Mathar, Jul 05 2022
MATHEMATICA
a[1] = a[3] = 1; a[2] = 2; a[n_] := a[n] = If[EvenQ[(s = a[n - 1] + a[n - 3])], s/2, s]; Array[a, 70] (* Amiram Eldar, Feb 27 2022 *)
nxt[{a_, b_, c_}]:={b, c, If[EvenQ[(a+c)], (a+c)/2, a+c]}; NestList[nxt, {1, 2, 1}, 70][[;; , 1]] (* Harvey P. Dale, Feb 25 2023 *)
CROSSREFS
Sequence in context: A234504 A112592 A370666 * A070036 A059779 A291874
KEYWORD
nonn,easy
AUTHOR
Jack Braxton, Feb 11 2022
EXTENSIONS
Definition clarified by Harvey P. Dale, Feb 25 2023
STATUS
approved