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
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, 20, 60, 21, 22, 23, 69, 24, 25, 75, 26, 78, 27, 28, 84, 29, 87, 30, 31, 32, 96, 33, 99, 34, 35, 105, 36, 37, 38, 114, 39, 117, 40, 41, 123, 42, 43, 129, 44, 132, 45, 46, 138, 47, 141 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Define an alternating 1-based sum S(n) = (1-0)+(1+1)+(1-2)+...(1-(-1)^n*n) = A064455(n+1).
The sequence evaluates this sum for an upper limit of the n-th nonprime A141468(n).
LINKS
FORMULA
a(n) = A064455(A141468(n)+1). - R. J. Mathar, Jul 19 2009
EXAMPLE
a(1) = 1 = 1 - (-1)^0*0.
a(2) = 3 = 1 - (-1)^0*0 + 1 -(-1)^1*1.
a(3) = 3 = 1 - (-1)^0*0 + 1 -(-1)^1*1 + 1 - (-2)^2*2 + 1 - (-1)^3*3 + 1 - (-1)^4*4.
MAPLE
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:
A064455 := proc(n) if type(n, 'even') then 3*n/2; else (n+1)/2 ; fi; end:
A162888 := proc(n) A064455(A141468(n)+1) ; end: seq(A162888(n), n=1..100) ; # R. J. Mathar, Jul 19 2009
CROSSREFS
Sequence in context: A241442 A363091 A043551 * A337402 A151759 A008443
KEYWORD
nonn
AUTHOR
EXTENSIONS
Definition edited by R. J. Mathar, Jul 19 2009
STATUS
approved

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 25 12:33 EDT 2024. Contains 371969 sequences. (Running on oeis4.)