OFFSET
1,1
COMMENTS
For n >= 11, a(n) = A159559(n), which means the two sequences merge.
We may define other sequences a(p-1,n), p prime, which start a(p-1,1)=p-1 and with the same property of n and a(p-1,n) being jointly prime or nonprime.
We find that for p=7, 11 and 13, the sequences a(6,n), a(10,n) and a(12,n) also merge with the current sequence for sufficiently large n. Does this also hold for primes >=17?
It was verified for primes p with 7<=p<=223 that this sequence a(4,n) and a(p-1,n) eventually merge. The corresponding values of n are 47, 683, 1117, 6257, 390703. - Alois P. Heinz, Mar 09 2011
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..20000
V. Shevelev, Several results on sequences which are similar to the positive integers, arXiv:0904.2101 [math.NT], 2009.
FORMULA
a(1) = 4; for n>1, a(n) = min { m > a(n-1) : m is prime iff n is prime }.
MAPLE
a:= proc(n) option remember; local m;
if n=1 then 4
else for m from a(n-1)+1 while isprime(m) xor isprime(n)
do od; m
fi
end:
seq(a(n), n=1..80); # Alois P. Heinz, Nov 21 2010
MATHEMATICA
a[n_] := a[n] = If[n==1, 4, For[m = a[n-1]+1, Xor[PrimeQ[m], PrimeQ[n]], m++]; m]; Table[a[n], {n, 1, 80}] (* Jean-François Alcover, Jan 31 2016, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Vladimir Shevelev, Apr 20 2009, May 04 2009
EXTENSIONS
More terms from Alois P. Heinz, Nov 21 2010
STATUS
approved