A330547 a(1)=2; thereafter a(n) = a(n-1) + (-1)^(n+1)*(prime(n)-prime(n-1)) (where prime(k) denotes the k-th prime).
2, 1, 3, 1, 5, 3, 7, 5, 9, 3, 5, -1, 3, 1, 5, -1, 5, 3, 9, 5, 7, 1, 5, -1, 7, 3, 5, 1, 3, -1, 13, 9, 15, 13, 23, 21, 27, 21, 25, 19, 25, 23, 33, 31, 35, 33, 45, 33, 37, 35, 39, 33, 35, 25, 31, 25, 31, 29, 35, 31, 33, 23, 37, 33, 35, 31, 45, 39, 49, 47, 51, 45, 53, 47, 53, 49, 55, 47, 51, 43, 53, 51, 61, 59, 65, 61
Offset: 1
Keywords
Links
- N. J. A. Sloane, Table of n, a(n) for n = 1..30000
- Hans Havermann, Plot of 4*10^8 terms of A330545, sampled every 1000 terms, points joined
- Hans Havermann, More detailed view of terms of A330545 from 290 million to 310 million, sampled every 10 terms, points joined.
- N. J. A. Sloane, Notes on the sequence of Bostrophedon primes (A330339) and the "ski-run" A330545.
- Frank Stevenson, Plot of first 10^10 terms of A330547, sampled every 10^5 steps. Havermann's plot of 4*10^8 terms appears at the very start of this plot.
- Frank Stevenson, Plot of first 10^11 terms of A330547, sampled every 10^6 steps. The preceding plot of 10^10 terms can be seen to the left of the blue line.
- Frank Stevenson, Plot of first 10^12 terms of A330547, sampled every 10^7 steps. The preceding plot of 10^11 terms can be seen to the left of the blue line.
Programs
-
Maple
f:=n-> (-1)^(n+1)*(ithprime(n)+2*add((-1)^i*ithprime(n-i),i=1..n-1)); [seq(f(n),n=1..400)];
-
Mathematica
a[1]=2; a[n_]:= a[a]=a[n-1]+ (-1)^(n+1)*(Prime[n]-Prime[n-1]);Table[a[n],{n,86}] (* James C. McMahon, Dec 18 2023 *)
Comments