A162888 An alternating sum of the first n nonprimes.
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
Offset: 1
Keywords
Examples
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.
Programs
-
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
Formula
Extensions
Definition edited by R. J. Mathar, Jul 19 2009
Comments