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

%I #13 Feb 01 2018 03:43:36

%S 0,1,3,6,2,7,13,20,28,19,29,40,52,65,79,94,110,127,109,128,148,127,

%T 149,172,196,221,247,274,302,331,361,392,424,457,491,526,562,599,637,

%U 676,716,757,799,842,886,931,977,1024,1072,1121,1171,1222,1274,1327,1381

%N a(0)=0. a(n) = a(n-1) - n, if a(n-1) - n = a (positive) prime. Otherwise a(n) = a(n-1) + n.

%C Terms a(1) through a(15) match the first 15 terms of A098141.

%F 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

%p 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

%o (PARI) r=0;vector(60,n,r=if(isprime(r-n),r-n,r+n)) \\ _Franklin T. Adams-Watters_, May 25 2010

%K nonn

%O 0,3

%A _Leroy Quet_, May 20 2010

%E More terms from _Franklin T. Adams-Watters_ and _R. J. Mathar_, May 25 2010

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 18 11:38 EDT 2024. Contains 371779 sequences. (Running on oeis4.)