cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A162888 An alternating sum of the first n nonprimes.

Original entry on oeis.org

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

Views

Author

Juri-Stepan Gerasimov, Jul 16 2009

Keywords

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).

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.
		

Crossrefs

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

a(n) = A064455(A141468(n)+1). - R. J. Mathar, Jul 19 2009

Extensions

Definition edited by R. J. Mathar, Jul 19 2009