%I #40 Dec 27 2021 21:53:41
%S 0,1,2,3,4,5,6,7,8,0,1,2,3,4,5,6,7,8,0,1,2,3,4,5,6,7,8,0,1,2,3,4,5,6,
%T 7,8,0,1,2,3,4,5,6,7,8,0,1,2,3,4,5,6,7,8,0,1,2,3,4,5,6,7,8,0,1,2,3,4,
%U 5,6,7,8,0,1,2,3,4,5,6,7,8,0,1,2,3,4,5,6,7,8,0,1,2,3,4,5,6,7,8,0,1,2,3,4,5
%N a(n) = n mod 9.
%C Periodic with period of length 9. The digital root of n (A010888) is a very similar sequence.
%C The rightmost digit in the base-9 representation of n. Also, the equivalent value of the two rightmost digits in the base-3 representation of n. - _Hieronymus Fischer_, Jun 11 2007
%H Ely Golden, <a href="/A010878/b010878.txt">Table of n, a(n) for n = 0..10000</a>
%H <a href="/index/Rec#order_09">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,0,0,0,0,1).
%F Complex representation: a(n)=(1/9)*(1-r^n)*sum{1<=k<9, k*product{1<=m<9,m<>k, (1-r^(n-m))}} where r=exp(2*pi/9*i) and i=sqrt(-1). Trigonometric representation: a(n)=(256/9)^2*(sin(n*pi/9))^2*sum{1<=k<9, k*product{1<=m<9,m<>k, (sin((n-m)*pi/9))^2}}. G.f.: g(x)=(sum{1<=k<9, k*x^k})/(1-x^9). Also: g(x)=x(8x^9-9x^8+1)/((1-x^9)(1-x)^2). - _Hieronymus Fischer_, May 31 2007
%F a(n) = n mod 3 + 3*(floor(n/3)mod 3) = A010872(n) + 3*A010872(A002264(n)). - _Hieronymus Fischer_, Jun 11 2007
%F a(n) = floor(12345678/999999999*10^(n+1)) mod 10. - _Hieronymus Fischer_, Jan 03 2013
%F a(n) = floor(1513361/96855122*9^(n+1)) mod 9. - _Hieronymus Fischer_, Jan 04 2013
%p A010878 := proc(n)
%p modp(n,9) ;
%p end proc:
%p seq(A010878(n),n=0..100) ; # _R. J. Mathar_, Sep 09 2015
%t Array[Mod[#, 9]&, 105, 0] (* _Jean-François Alcover_, Jan 30 2018 *)
%t PadRight[{},120,Range[0,8]] (* _Harvey P. Dale_, Dec 19 2018 *)
%o (Haskell)
%o a010878 = (`mod` 9)
%o a010878_list = cycle [0..8] -- _Reinhard Zumkeller_, Jan 09 2013
%o (PARI) a(n)=n%9 \\ _Charles R Greathouse IV_, Sep 24 2015
%Y Partial sums: A130487. Other related sequences A130481, A130482, A130483, A130484, A130485, A130486.
%K nonn,easy
%O 0,3
%A _N. J. A. Sloane_