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!)
A280028 a(1)=1; thereafter, if n even, a(n) = a(n-1)-st prime, and if n odd, a(n) = a(n-1)-st nonprime. 4

%I #31 Dec 28 2016 10:05:12

%S 1,2,4,7,12,37,52,239,301,1993,2338,20753,23356,266587,291968,4134187,

%T 4446630,75947059,80652283,1625456353,1710094788,39954587527,

%U 41737658509,1114336791787,1157634258442,34900173534517,36096139358620,1216553712004063

%N a(1)=1; thereafter, if n even, a(n) = a(n-1)-st prime, and if n odd, a(n) = a(n-1)-st nonprime.

%C This is the sequence S_1 mentioned in A141436. The primes and nonprimes alternate.

%p P:=n->ithprime(n);

%p # let b1 be a list of the nonprimes (from the b-file for A018252)

%p N:=n->if n<=nops(b1) then b1[n] else 0; fi;;

%p f:=proc(m) local S,n,sw,t; global P,N;

%p S:=[m]; t:=m;

%p if isprime(m) then sw:=1; else sw:=2; fi;

%p if sw=1 then

%p for n from 2 to 60 do

%p if n mod 2 = 0 then t:=N(t); if t=0 then return(S); fi; else t:=P(t); fi; S:=[op(S),t];

%p od:

%p else

%p for n from 2 to 60 do

%p if n mod 2 = 0 then t:=P(t); else t:=N(t); if t=0 then return(S); fi; fi; S:=[op(S),t];

%p od:

%p fi;

%p S;

%p end;

%p f(1); # A280028

%p f(3); # A280029

%p f(5); # A280030

%t nonPrime[n_Integer] := FixedPoint[n + PrimePi@# &, n + PrimePi@ n]; a[n_] := If[ OddQ@ n, nonPrime[ a[n -1]], Prime@a[n -1]]; a[1] = 1; Array[a, 26] (* _Robert G. Wilson v_, Dec 28 2016 *)

%Y Cf. A000040, A018252, A141436, A280029, A280030.

%K nonn

%O 1,2

%A _N. J. A. Sloane_, Dec 25 2016

%E a(13)-a(27) from _Hans Havermann_, Dec 25 2016

%E a(28) from _Chai Wah Wu_, Dec 26 2016

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 March 28 18:04 EDT 2024. Contains 371254 sequences. (Running on oeis4.)