Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #11 Jan 06 2024 19:40:30
%S 1,6,5,2,0,7,4,3,8,8,3,4,7,0,2,5,6,1,1,6,5,2,0,7,4,3,8,8,3,4,7,0,2,5,
%T 6,1,1,6,5,2,0,7,4,3,8,8,3,4,7,0,2,5,6,1,1,6,5,2,0,7,4,3,8,8,3,4,7,0,
%U 2,5,6,1,1,6,5,2,0,7,4,3,8,8,3,4,7,0,2,5,6,1,1,6,5,2,0,7,4,3,8,8,3,4,7,0,2
%N a(n) = (-1)^n*(2*n+1) (mod 9).
%F Period 18 sequence: [1, 6, 5, 2, 0, 7, 4, 3, 8, 8, 3, 4, 7, 0, 2, 5, 6, 1].
%p seq(`mod`((-1)^n*(2*n+1), 9), n = 0..120); # _G. C. Greubel_, Nov 05 2019
%t Table[Mod[(-1)^n*(2*n+1), 9], {n, 0, 120}] (* _G. C. Greubel_, Nov 05 2019 *)
%t Mod[Times@@@Partition[Riffle[Range[1,221,2],{1,-1},{1,-1,2}],2],9] (* _Harvey P. Dale_, Jan 06 2024 *)
%o (PARI) a(n)=((-1)^n*(2*n+1))%9
%o (Magma) [(-1)^n*(2*n+1) mod 9 : n in [0..120]]; // _G. C. Greubel_, Nov 05 2019
%o (Sage) [mod((-1)^n*(2*n+1), 9) for n in (0..120)] # _G. C. Greubel_, Nov 05 2019
%o (GAP) List([0..120], n-> (-1)^n*(2*n+1) mod 9 ); # _G. C. Greubel_, Nov 05 2019
%Y Cf. A112280.
%K nonn
%O 0,2
%A _Paul D. Hanna_, Sep 01 2005