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!)
A051353 a(n) = a(n-1) + n^2 if n prime else a(n-1) - n. 1

%I #10 Aug 28 2016 18:23:39

%S 0,-1,3,12,8,33,27,76,68,59,49,170,158,327,313,298,282,571,553,914,

%T 894,873,851,1380,1356,1331,1305,1278,1250,2091,2061,3022,2990,2957,

%U 2923,2888,2852,4221,4183,4144,4104,5785,5743,7592,7548

%N a(n) = a(n-1) + n^2 if n prime else a(n-1) - n.

%H T. D. Noe, <a href="/A051353/b051353.txt">Table of n, a(n) for n = 0..1000</a>

%F a(n) = a(n-1) + n*(A010051(n)*(n+1)-1). - _Reinhard Zumkeller_, Aug 13 2013

%t nxt[{n_,a_}]:={n+1,If[PrimeQ[n+1],a+(n+1)^2,a-(n+1)]}; Transpose[ NestList[ nxt,{0,0},50]][[2]] (* _Harvey P. Dale_, Dec 12 2012 *)

%o (Haskell)

%o a051353 n = a051353_list !! n

%o a051353_list = 0 : zipWith (+) a051353_list

%o (zipWith (\chi x -> x * (chi * (x + 1) - 1)) a010051_list [1..])

%o -- _Reinhard Zumkeller_, Aug 13 2013

%K sign,easy,nice

%O 0,3

%A Armand Turpel armandt(AT)unforgettable.com

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 August 19 08:00 EDT 2024. Contains 375284 sequences. (Running on oeis4.)