%I #18 Jul 28 2022 03:42:12
%S 0,4,5,3,9,10,6,14,15,9,19,20,12,24,25,15,29,30,18,34,35,21,39,40,24,
%T 44,45,27,49,50,30,54,55,33,59,60,36,64,65,39,69,70,42,74,75,45,79,80,
%U 48,84,85,51,89,90,54,94,95,57,99,100,60,104,105,63,109,110,66,114,115,69,119,120,72,124,125,75,129,130
%N If n is of the form 3k, then a(n) = n, and if n is of the form 3k+r, with r = 1 or 2, then a(n) = 5*k + 3 + r.
%H Michael De Vlieger, <a href="/A353314/b353314.txt">Table of n, a(n) for n = 0..10000</a>
%H Nicholas Drozd, <a href="https://nickdrozd.github.io/2021/10/31/busy-beaver-derived.html">A Busy Beaver Champion Derived from Scratch</a>
%H Nicholas Drozd, <a href="https://sites.math.rutgers.edu/~zeilberg/fb155Drozd.txt">Feedback to Doron Zeilberger's opinion #155</a>, Jan. 4, 2022.
%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,2,0,0,-1).
%F a(n) = n + A353327(n) = n + A102899(3+n).
%F From _Chai Wah Wu_, Jul 27 2022: (Start)
%F a(n) = 2*a(n-3) - a(n-6) for n > 5.
%F G.f.: x*(x^3 + 3*x^2 + 5*x + 4)/(x^6 - 2*x^3 + 1). (End)
%t Array[If[#2 == 0, #1, 5 #1 + 3 + #2 & @@ QuotientRemainder[#1, 3]] & @@ {#, Mod[#, 3]} &, 78, 0] (* _Michael De Vlieger_, Apr 14 2022 *)
%o (PARI) A353314(n) = { my(r=(n%3)); if(!r,n,((5*((n-r)/3)) + r + 3)); };
%Y Cf. A353313 (variant), A349876 (the first multiple of 3 reached when iterating this sequence), A349877 (number of iterations to reach the first multiple of 3), A353327 (A102899).
%K nonn,easy
%O 0,2
%A _Antti Karttunen_, Apr 14 2022