login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A092950
Beginning with n, add the next number, subtract the previous number and so on until one gets a prime, or 0 if no such prime is reached in 2n-1 steps: a(n) = n + (n+1) - (n-1) +(n+2) -(n-2) +(n+3)-(n-3)...+...is the first occurring prime at any step.
1
3, 2, 3, 17, 5, 13, 7, 17, 19, 29, 11, 73, 13, 29, 31, 41, 17, 37, 19, 41, 43, 53, 23, 73, 31, 53, 29, 137, 29, 61, 31, 73, 67, 149, 71, 73, 37, 101, 79, 89, 41, 109, 43, 89, 47, 101, 47, 97, 107, 101, 103, 113, 53, 109, 61, 113, 59, 197, 59, 241, 61, 149, 127, 137, 131, 157
OFFSET
1,1
COMMENTS
a(p) = p, p is a prime. If the process is continued until a 1 is subtracted the result is n^2. Conjecture: No term is zero.
FORMULA
The k-th step of the process used to generate the n-th term is 2n+(k^2)/4 if k is even and n+(k^2-1)/4 if k is odd. - Adam M. Kalman (mocha(AT)clarityconnect.com), Nov 09 2004
EXAMPLE
a(4) = 17 and the steps are 4, 4+5, 4+5-3, 4+5-3+6, 4+5-3+6-2, 4+5-3+6-2+7= 17. a(6) = 6+7 =13.
MATHEMATICA
For[a=1, a<100, x:=a; s:=1; While[(!PrimeQ[x])\[And](s<=2a-1), If[OddQ[s], x+=a+(s+1)/2, x+=-a+s/2]; s++ ]; If[PrimeQ[x], Print[x], Print[0]]; a++ ]; (Kalman)
CROSSREFS
Sequence in context: A247237 A059366 A298594 * A059239 A350517 A123170
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Mar 24 2004
EXTENSIONS
More terms from Adam M. Kalman (mocha(AT)clarityconnect.com), Nov 09 2004
STATUS
approved