OFFSET
1,2
LINKS
PROG
(PARI) nextcomposite(c) = until (!isprime(c), c +=2); c;
listaa(nn) = {print1(1, ", "); vp = [2]; vc = [1]; for (n=2, nn, if (isprime(n), newa = nextcomposite(vecmax(vc)); vc = concat(vc, newa), newa = nextprime(vecmax(vp)+1); vp = concat(vp, newa)); print1((newa+1)/2, ", "); ); }
(PARI) lista(n) = {my(p=3, c=9, l=List([1])); for(i=2, n, if(isprime(i), listput(l, (c+1)/2); until(!isprime(c), c+=2), listput(l, (p+1)/2); p = nextprime(p+1))); l} \\ David A. Corneth, Apr 01 2017, after Michel Marcus
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Marcus, Apr 01 2017
STATUS
approved