login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
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: A339557 A226940 A098141 * A356080 A135598 A244619
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 | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 18:17 EDT 2024. Contains 371962 sequences. (Running on oeis4.)