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!)
A103825 Choose a(n) to be the smallest number not yet used such that: a(1) = 1, a(2n) = composite, a(2n+1) = prime and partial sums are alternately prime or composite. 7

%I #8 Nov 26 2020 19:23:36

%S 1,4,3,9,5,15,2,8,7,25,11,49,13,21,17,33,19,27,23,39,29,119,31,77,37,

%T 35,41,51,43,45,47,55,53,57,59,91,61,65,67,87,71,69,73,93,79,85,83,95,

%U 89,63,97,81,101,99,103,75,107,105,109,141,113,115,127,125,131,111,137

%N Choose a(n) to be the smallest number not yet used such that: a(1) = 1, a(2n) = composite, a(2n+1) = prime and partial sums are alternately prime or composite.

%H Robert Israel, <a href="/A103825/b103825.txt">Table of n, a(n) for n = 1..10000</a>

%p N:= 1000: # for terms before the first term > N

%p Avail:= [$2..N]:

%p A[1]:= 1: T:= 1:

%p for n from 2 while assigned(A[n-1]) do

%p for j from 1 to N+1-n do

%p x:= Avail[j];

%p if (n::even and isprime(x+T) and not isprime(x)) or

%p (n::odd and isprime(x) and not isprime(x+T)) then

%p A[n]:= x; T:= T+x;

%p Avail:= subsop(j=NULL, Avail);

%p break

%p fi

%p od

%p od:

%p seq(A[i],i=1..n-2); # _Robert Israel_, Nov 26 2020

%Y Cf. A075593, A075594, A103824.

%K nonn

%O 1,2

%A _Ray Chandler_ Feb 16 2005

%E Definition corrected by _Zak Seidov_, Feb 20 2005

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 16 03:28 EDT 2024. Contains 371696 sequences. (Running on oeis4.)