login
a(n) = n mod 6.
47

%I #82 Sep 08 2022 08:44:37

%S 0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,

%T 4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,

%U 2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0

%N a(n) = n mod 6.

%C Period 6: repeat [0, 1, 2, 3, 4, 5].

%C The rightmost digit in the base-6 representation of n. - _Hieronymus Fischer_, Jun 11 2007

%C [a(n) * a(m)] mod 6 == a(n*m mod 6) == a(n*m). - _Jon Perry_, Nov 11 2014

%C If n > 3 and (a(n) is in {0,2,3,4}), then n is not prime. - _Jean-Marc Rebert_, Jul 22 2015, corrected by _M. F. Hasler_, Jul 24 2015

%H Antti Karttunen, <a href="/A010875/b010875.txt">Table of n, a(n) for n = 0..65538</a>

%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,0,1).

%F Complex representation: a(n) = (1/6) * (1 - r^n) * Sum_{k = 1..6} k * Product_{1 <= m < 6, m <> k} (1-r^(n-m)), where r = exp((Pi/3)*i) = (1 + sqrt(3)*i)/2 and i = sqrt(-1).

%F Trigonometric representation: a(n) = (16/3)^2 * (sin(n*Pi/6))^2 * Sum_{k = 1..6} k * Product_{1 <= m < 6, m<>k} (sin((n-m)*Pi/6))^2.

%F G.f.: g(x) = (Sum_{k = 1..6} k*x^k)/(1-x^6).

%F Also: g(x) = x*(5*x^6 - 6*x^5 + 1)/((1 - x^6)*(1 - x)^2). - _Hieronymus Fischer_, May 31 2007

%F a(n) = (n mod 2) + 2(floor(n/2) mod 3) = A000035(n) +2*A010872(A004526(n));

%F a(n) = (n mod 3) + 3(floor(n/3) mod 2) = A010872(n) +3*A000035(A002264(n)). - _Hieronymus Fischer_, Jun 11 2007

%F a(n) = 2.5 - 0.5*(-1)^n - cos(Pi*n/3) - 3^0.5*sin(Pi*n/3) -cos(2*Pi*n/3) - 3^0.5/3*sin(2*Pi*n/3). - _Richard Choulet_, Dec 11 2008

%F a(n) = n^3 mod 6. - _Zerinvary Lajos_, Oct 29 2009

%F a(n) = floor(12345/999999*10^(n+1)) mod 10. - _Hieronymus Fischer_, Jan 03 2013

%F a(n) = floor(373/9331*6^(n+1)) mod 6. - _Hieronymus Fischer_, Jan 04 2013

%F a(n) = 5/2 - (-1)^n/2 - 2*0^((-1)^(n/6 - 1/12 + (-1)^n/12) - (-1)^(n/2 - 1/4 +(-1)^n/4)) + 2*0^((-1)^(n/6 + 1/4 + (-1)^n/12) + (-1)^(n/2 - 1/4 + (-1)^n/4)). - _Wesley Ivan Hurt_, Jun 23 2015

%F E.g.f.: -sqrt(3)*exp(x/2)*sin(sqrt(3)*x/2) - 2*cosh(x/2)*cos(sqrt(3)*x/2). - _Robert Israel_, Jul 22 2015

%p A010875:=n->n mod 6; seq(A010875(n), n=0..100); # _Wesley Ivan Hurt_, Jul 06 2014

%t Mod[Range[0, 100], 6] (* _Wesley Ivan Hurt_, Jul 06 2014 *)

%o (Sage) [power_mod(n,3,6 )for n in range(0, 81)] # _Zerinvary Lajos_, Oct 29 2009

%o (PARI) a(n)=n%6 \\ _Charles R Greathouse IV_, Dec 05 2011

%o (Magma) [n mod 6: n in [0..100]]; // _Wesley Ivan Hurt_, Jul 06 2014

%o (Scheme) (define (A010875 n) (modulo n 6)) ;; _Antti Karttunen_, Dec 22 2017

%Y Partial sums: A130484. Other related sequences A130481, A130482, A130483, A130485.

%Y Cf. also A079979, A097325, A122841.

%K nonn,easy

%O 0,3

%A _N. J. A. Sloane_

%E Formulas 1 to 6 re-edited for better readability by _Hieronymus Fischer_, Dec 05 2011

%E More terms from _Antti Karttunen_, Dec 22 2017