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”).
%I #7 Dec 05 2013 19:56:46
%S 3,2,3,17,5,13,7,17,19,29,11,73,13,29,31,41,17,37,19,41,43,53,23,73,
%T 31,53,29,137,29,61,31,73,67,149,71,73,37,101,79,89,41,109,43,89,47,
%U 101,47,97,107,101,103,113,53,109,61,113,59,197,59,241,61,149,127,137,131,157
%N 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.
%C 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.
%F 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
%e 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.
%t 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)
%Y Cf. A092951, A092952.
%K nonn
%O 1,1
%A _Amarnath Murthy_, Mar 24 2004
%E More terms from Adam M. Kalman (mocha(AT)clarityconnect.com), Nov 09 2004