login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A261038 a(1)=1; for n>1: a(n) = a(n-1)*n if t=0, a(n) = round(a(n-1)/n) if t=1, a(n) = a(n-1)+n if t=2, a(n) = a(n-1)-n if t=3, where t = n mod 4. 1

%I #53 May 25 2018 12:11:10

%S 1,3,0,0,0,6,-1,-8,-1,9,-2,-24,-2,12,-3,-48,-3,15,-4,-80,-4,18,-5,

%T -120,-5,21,-6,-168,-6,24,-7,-224,-7,27,-8,-288,-8,30,-9,-360,-9,33,

%U -10,-440,-10,36,-11,-528,-11,39,-12,-624,-12,42,-13,-728,-13,45,-14

%N a(1)=1; for n>1: a(n) = a(n-1)*n if t=0, a(n) = round(a(n-1)/n) if t=1, a(n) = a(n-1)+n if t=2, a(n) = a(n-1)-n if t=3, where t = n mod 4.

%C a(4*n+1) = 1, 0, -1, -2, -3, ...

%C a(4*n+2) = 3, 6, 9, 12, 15, ...

%C a(4*n+3) = 0, -1, -2, -3, -4, ...

%C a(4*n+4) = 0, -8, -24, -48, -80, ... = -A033996(n).

%H Alois P. Heinz, <a href="/A261038/b261038.txt">Table of n, a(n) for n = 1..10000</a>

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

%F From _Colin Barker_, Aug 09 2015: (Start)

%F a(n) = 3*a(n-4) - 3*a(n-8) + a(n-12).

%F G.f.: -x*(x^10+2*x^8-8*x^7-x^6-3*x^5-3*x^4+3*x+1) / ((x-1)^3*(x+1)^3*(x^2+1)^3).

%F (End)

%e a(1) = 1.

%e a(2) = a(1) + 2 = 3.

%e a(3) = a(2) - 3 = 0.

%e a(4) = a(3) * 4 = 0.

%e a(5) = round(a(4) / 5) = 0.

%e a(6) = a(5) + 6 = 6.

%e a(7) = a(6) - 7 = -1.

%p a:= proc(n) option remember; `if`(n=1, 1, (t->

%p `if`(t=0, a(n-1)*n, `if`(t=1, round(a(n-1)/n),

%p `if`(t=2, a(n-1)+n, a(n-1)-n))))(irem(n, 4)))

%p end:

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Aug 08 2015

%t nxt[{n_,a_}]:=Module[{t=Mod[n+1,4]},{n+1,Which[t==0,a(n+1), t==1,Round[ a/(n+1)], t==2,a+n+1,t==3,a-n-1]}]; NestList[nxt,{1,1},100][[All,2]] (* or *) LinearRecurrence[{0,0,0,3,0,0,0,-3,0,0,0,1},{1,3,0,0,0,6,-1,-8,-1,9,-2,-24},100] (* _Harvey P. Dale_, May 25 2018 *)

%o (PARI) Vec(-x*(x^10+2*x^8-8*x^7-x^6-3*x^5-3*x^4+3*x+1)/((x-1)^3*(x+1)^3*(x^2+1)^3) + O(x^100)) \\ _Colin Barker_, Aug 10 2015

%o (PARI) first(m)=my(v=vector(m),t);v[1]=1;for(i=2,m,t = i%4;if(t==0,v[i]=v[i-1]*i,if(t==1,v[i]=round(v[i-1]/i),if(t==2,v[i]=v[i-1]+i,v[i]=v[i-1]-i ))));v; \\ _Anders Hellström_, Aug 17 2015

%Y Cf. A033996.

%K sign,easy

%O 1,2

%A _Peter Woodward_, Aug 07 2015

%E More terms from _Alois P. Heinz_, Aug 08 2015

%E Edited by _Jon E. Schoenfield_, Aug 08 2015

%E Corrected by _Harvey P. Dale_, May 25 2018

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 10:07 EDT 2024. Contains 371905 sequences. (Running on oeis4.)