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!)
A162888 An alternating sum of the first n nonprimes. 1

%I #8 Mar 03 2019 01:56:59

%S 1,3,3,4,5,15,6,7,8,24,9,10,11,33,12,13,39,14,42,15,16,17,51,18,54,19,

%T 20,60,21,22,23,69,24,25,75,26,78,27,28,84,29,87,30,31,32,96,33,99,34,

%U 35,105,36,37,38,114,39,117,40,41,123,42,43,129,44,132,45,46,138,47,141

%N An alternating sum of the first n nonprimes.

%C Define an alternating 1-based sum S(n) = (1-0)+(1+1)+(1-2)+...(1-(-1)^n*n) = A064455(n+1).

%C The sequence evaluates this sum for an upper limit of the n-th nonprime A141468(n).

%F a(n) = A064455(A141468(n)+1). - _R. J. Mathar_, Jul 19 2009

%e a(1) = 1 = 1 - (-1)^0*0.

%e a(2) = 3 = 1 - (-1)^0*0 + 1 -(-1)^1*1.

%e a(3) = 3 = 1 - (-1)^0*0 + 1 -(-1)^1*1 + 1 - (-2)^2*2 + 1 - (-1)^3*3 + 1 - (-1)^4*4.

%p A141468 := proc(n) option remember; local a; if n = 1 then 0 ; else for a from procname(n-1)+1 do if not isprime(a) then RETURN(a) ; fi; od: fi; end:

%p A064455 := proc(n) if type(n,'even') then 3*n/2; else (n+1)/2 ; fi; end:

%p A162888 := proc(n) A064455(A141468(n)+1) ; end: seq(A162888(n),n=1..100) ; # _R. J. Mathar_, Jul 19 2009

%Y Cf. A064455, A141468.

%K nonn

%O 1,2

%A _Juri-Stepan Gerasimov_, Jul 16 2009

%E Definition edited by _R. J. Mathar_, Jul 19 2009

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 24 18:17 EDT 2024. Contains 371962 sequences. (Running on oeis4.)