A075594 a(1) = 1, a(2n) = composite, a(2n+1) = prime and sum of two successive terms is alternately prime or composite.
1, 4, 2, 9, 3, 8, 7, 6, 19, 10, 5, 12, 13, 16, 11, 18, 17, 14, 31, 22, 23, 20, 29, 24, 41, 26, 37, 30, 47, 32, 43, 28, 53, 36, 59, 38, 61, 40, 71, 42, 73, 34, 83, 44, 67, 46, 79, 48, 97, 52, 89, 50, 103, 54, 101, 56, 109, 58, 107, 60, 127, 64, 113, 66, 137, 62, 139, 72, 131
Offset: 1
Keywords
Examples
After terms 1, 4, 2, 9, 3, we seek the next term (n = 6). The requirement is the smallest composite not already seen that summed with a(5) is prime. That number is 8 and becomes a(6). Similarly, for n = 7, we require the smallest prime not already seen that summed with a(6) is composite. As 8 + 5 is not composite, a(7) = 7. - _Bill McEachen_, Feb 13 2023
Links
- Bill McEachen, Table of n, a(n) for n = 1..10000
Programs
-
PARI
genit(nterms=69)={arr=List();listput(arr,1);listput(arr,4);summ=arr[#arr]+arr[#arr-1];for(ptr=3,+oo,if(#arr>nterms,break);for(i=2,+oo,if(ptr%2!=0&&isprime(i),q=arr[ptr-1]+i;z=Set(arr);if(setsearch(z,i)>0,next);z=Set();if(isprime(summ)&& !isprime(q),listput(arr,i);summ=arr[#arr]+arr[#arr-1];break));if(ptr%2==0&&!isprime(i),q=arr[ptr-1]+i;z=Set(arr);if(setsearch(z,i)>0,next);z=Set();if(!isprime(summ)&& isprime(q),listput(arr,i);summ=arr[#arr]+arr[#arr-1];break))));arr} \\ Bill McEachen, Apr 09 2023
Extensions
Extended by Ray Chandler Feb 16 2005
Comments