This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A175458 a(0)=0. a(n) = a(n-1) - n, if a(n-1) - n = a (positive) prime. Otherwise a(n) = a(n-1) + n. 1
 0, 1, 3, 6, 2, 7, 13, 20, 28, 19, 29, 40, 52, 65, 79, 94, 110, 127, 109, 128, 148, 127, 149, 172, 196, 221, 247, 274, 302, 331, 361, 392, 424, 457, 491, 526, 562, 599, 637, 676, 716, 757, 799, 842, 886, 931, 977, 1024, 1072, 1121, 1171, 1222, 1274, 1327, 1381 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,3 COMMENTS Terms a(1) through a(15) match the first 15 terms of A098141. LINKS FORMULA The only decreases are for n = 4, 9, 18, and 21. Thereafter, a(n) = n*(n+1)/2-104, so a(n)-(n+1) = n*(n-1)/2-105 = (n-15)*(n+14)/2, which is not prime (for n > 17). - Franklin T. Adams-Watters, May 25 2010 MAPLE A175458 := proc(n) option remember; if n =0 then 0; else if isprime( procname(n-1)-n) then procname(n-1)-n; else procname(n-1)+n ; end if; end if; end proc: seq(A175458(n), n=0..120) ; # R. J. Mathar, May 28 2010 PROG (PARI) r=0; vector(60, n, r=if(isprime(r-n), r-n, r+n)) \\ Franklin T. Adams-Watters, May 25 2010 CROSSREFS Sequence in context: A171884 A226940 A098141 * A135598 A244619 A099506 Adjacent sequences:  A175455 A175456 A175457 * A175459 A175460 A175461 KEYWORD nonn AUTHOR Leroy Quet, May 20 2010 EXTENSIONS More terms from Franklin T. Adams-Watters and R. J. Mathar, May 25 2010 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified July 17 09:23 EDT 2019. Contains 325100 sequences. (Running on oeis4.)