%I #64 Dec 14 2023 05:12:49
%S 1,5,7,8,4,2,1,5,7,8,4,2,1,5,7,8,4,2,1,5,7,8,4,2,1,5,7,8,4,2,1,5,7,8,
%T 4,2,1,5,7,8,4,2,1,5,7,8,4,2,1,5,7,8,4,2,1,5,7,8,4,2,1,5,7,8,4,2,1,5,
%U 7,8,4,2,1,5,7,8,4,2,1,5,7,8,4,2,1,5,7,8,4,2,1,5,7,8,4,2,1,5,7,8,4,2,1,5,7
%N a(n) = 5^n mod 9.
%C Period 6: repeat [1, 5, 7, 8, 4, 2].
%C Also the digital root of 5^n. - _Cino Hilliard_, Dec 31 2004
%C Digital root of the powers of any number congruent to 5 mod 9. - _Alonso del Arte_, Jan 26 2014
%D Cecil Balmond, Number 9: The Search for the Sigma Code. Munich, New York: Prestel (1998): 203.
%H G. C. Greubel, <a href="/A070366/b070366.txt">Table of n, a(n) for n = 0..1000</a>
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,-1,1).
%F From _R. J. Mathar_, Apr 20 2010: (Start)
%F a(n) = a(n-1) - a(n-3) + a(n-4) for n>3.
%F G.f.: ( 1+4*x+2*x^2+2*x^3 ) / ( (1-x)*(1+x)*(x^2-x+1) ). (End)
%F a(n) = 1/2^n (mod 9), n >= 0. - _Wolfdieter Lang_, Feb 18 2014
%F a(n) = A010878(A000351(n)). - _Michel Marcus_, Feb 20 2014
%F From _G. C. Greubel_, Mar 05 2016: (Start)
%F a(n) = a(n-6) for n>5.
%F E.g.f.: (1/2)*(9*exp(x) - exp(-x) + 2*sqrt(3)*exp(x/2)*sin(sqrt(3)*x/2) - 6*exp(x/2)*cos(sqrt(3)*x/2)). (End)
%F a(n) = (9 - cos(n*Pi) - 6*cos(n*Pi/3) + 2*sqrt(3)*sin(n*Pi/3))/2. - _Wesley Ivan Hurt_, Jun 28 2016
%F a(n) = 2^((-n) mod 6) mod 9. - _Joe Slater_, Mar 23 2017
%p A070366:=n->power(5,n) mod 9: seq(A070366(n), n=0..100); # _Wesley Ivan Hurt_, Jun 28 2016
%t PowerMod[5, Range[0, 120], 9] (* _Harvey P. Dale_, Mar 27 2011 *)
%t Table[Mod[5^n, 9], {n, 0, 100}] (* _G. C. Greubel_, Mar 05 2016 *)
%o (PARI) a(n)=lift(Mod(5,9)^n); \\ _Charles R Greathouse IV_, Sep 24 2015
%o (Magma) [Modexp(5, n, 9): n in [0..100]]; // _Wesley Ivan Hurt_, Jun 28 2016
%Y Cf. Digital roots of powers of c mod 9: c = 2, A153130; c = 4, A100402; c = 7, A070403; c = 8, A010689.
%Y Cf. A000351, A010878.
%K nonn,easy
%O 0,2
%A _N. J. A. Sloane_, May 12 2002