cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A105198 a(n) = n(n+1)/2 mod 4.

This page as a plain text file.
%I A105198 #48 Jul 02 2025 16:02:02
%S A105198 0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,
%T A105198 3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,
%U A105198 2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0
%N A105198 a(n) = n(n+1)/2 mod 4.
%C A105198 0,1,3,2,2,3,1,0 repeated indefinitely.
%C A105198 If N is any power of 2 then n(n+1)/2 mod N is a repeating pattern of length 2N. Moreover, the first N digits form a permutation P of A={0,1,...,N-1}. The subsequent N digits are P in the reversed order. The technique is useful for the generation of arbitrarily large pseudo-random permutations.
%H A105198 Antti Karttunen, <a href="/A105198/b105198.txt">Table of n, a(n) for n = 0..8191</a>
%H A105198 O. Y. Takeshita and D. J. Costello, Jr., <a href="http://dx.doi.org/10.1109/18.868474">New Deterministic Interleaver Designs for Turbo-Codes</a>, IEEE Trans. Inform. Theory, vol. 46, no. 6, pp. 1988-2006, Sept. 2000.
%H A105198 <a href="/index/Rec#order_07">Index entries for linear recurrences with constant coefficients</a>, signature (1,-1,1,-1,1,-1,1).
%F A105198 From _Paul Barry_, Jul 26 2005: (Start)
%F A105198 G.f.: (x + 2x^2 + 2x^4 + x^5)/(1 - x + x^2 - x^3 + x^4 - x^5 + x^6 - x^7).
%F A105198 a(n) = a(n-1) - a(n-2) + a(n-3) - a(n-4) + a(n-5) - a(n-6) + a(n-7).
%F A105198 a(n) = cos(3*Pi*n/4 + Pi/4)/2 + (1/2 - sqrt(2)/2)*sin(3*Pi*n/4 + Pi/4) - (1/2 + sqrt(2)/2)*cos(Pi*n/4 + Pi/4) - sin(Pi*n/4 + Pi/4)/2 - cos(Pi*n/2)/2 + sin(Pi*n/2)/2 + 3/2. (End)
%F A105198 a(n) = (((n+1)^5 - n^5 - 1) mod 120)/30. - _Gary Detlefs_, Mar 25 2012
%F A105198 a(n) = -ceiling(n/2)*(-1)^n mod 4. - _Wesley Ivan Hurt_, Jul 13 2014
%p A105198 for n from 0 to 300 do printf(`%d,`, n*(n+1)/2 mod 4) od: # _James Sellers_, Apr 21 2005
%p A105198 A105198:=n->-ceil(n/2)*(-1)^n mod 4: seq(A105198(n), n=0..100); # _Wesley Ivan Hurt_, Jul 13 2014
%t A105198 Table[Mod[-Ceiling[n/2] (-1)^n, 4], {n, 0, 100}] (* _Wesley Ivan Hurt_, Jul 13 2014 *)
%o A105198 (Magma) [ -Ceiling(n/2)*(-1)^n mod 4 : n in [0..100]]; // _Wesley Ivan Hurt_, Jul 13 2014
%o A105198 (PARI) Vec((x+2*x^2+2*x^4+x^5)/(1-x+x^2-x^3+x^4-x^5+x^6-x^7) + O(x^90)) \\ _Michel Marcus_, Jul 13 2014
%o A105198 (Scheme) (define (A105198 n) (modulo (* 1/2 n (+ 1 n)) 4)) ;; _Antti Karttunen_, Aug 10 2017
%o A105198 (Python)
%o A105198 def A105198(n): return (n*(n+1)>>1)&3 # _Chai Wah Wu_, Apr 17 2025
%Y A105198 Cf. triangular numbers A000217, A105332-A105340.
%Y A105198 One less than A110549, A133882 shifted once right, with zero inserted to front.
%K A105198 nonn,easy
%O A105198 0,3
%A A105198 _Oscar Takeshita_, Apr 11 2005
%E A105198 More terms from _James Sellers_, Apr 21 2005