OFFSET
1,1
COMMENTS
Original name was: Difference and sum of staircase primes according to the rule: bottom - top + next top.
We list the primes in staircase fashion as follows.
2
3.5
..7.11
....13.17
.......19.23
..........29.31
.............37.41
.....................
....................n
....................n+1.n+2.
The right diagonal, RD(n), is the set of top primes and the left diagonal, LD(x), is the set of bottom primes. Then a(n) = LD(n+1) - RD(n) + RD(n+2).
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = A181428(2*n-1). - R. J. Mathar, Sep 10 2016
MATHEMATICA
Join[{6}, #[[3]]-#[[2]]+#[[4]]&/@Partition[Prime[Range[2, 110]], 4, 2]] (* Harvey P. Dale, Nov 16 2011 *)
PROG
(PARI) g(n) = forstep(x=1, n, 2, y=prime(x+1)-prime(x)+prime(x+2); print1(y", "))
(PARI) a(n)=prime(2*n)-prime(2*n-1)+prime(2*n+1); \\ Joerg Arndt, Oct 08 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Cino Hilliard, Dec 02 2007
EXTENSIONS
New name from Joerg Arndt, Oct 08 2016
STATUS
approved