OFFSET
1,2
EXAMPLE
The nonprime numbers are: [1, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20].
Those with prime positions are: [4, 6, 9, 12, 18].
Those with nonprime positions are: [1, 8, 10, 14, 15, 16, 20].
So we have {f(1)} = {1,4,14,60,...}, {f(6)} = {6,16,74,...}, {f(8)} ={8,28,56,...}; so the current sequence are the first elements, {1,6,8,...etc}.
PROG
(PARI) lista(nn) = {my(va = select(x->(! isprime(x)), [1..nn])); my(vap = vector(primepi(#va), k, va[prime(k)])); my(vanp = Vec(setminus(va, vap))); my(vused = vector(#va), ok=1, last=0, list=List(), new, ok2); while(ok, last++; while ((last <= #vused) && vused[last], last++); if (last > #vused, break); new = va[last]; listput(list, new); ok2 = 1; my(list1 = List()); listput(list1, new); while(ok2, pos = setsearch(va, new); if (!pos, ok2=0, vused[pos] = 1; if (isprime(pos), if (new <= #vanp, new = vanp[new], ok2=0), if (new <= #vap, new = vap[new], ok2=0); ); listput(list1, new); ); ); ); Vec(list); } \\ Michel Marcus, Aug 18 2022
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Daniel Tisdale, Jun 05 2009, Jun 10 2009
EXTENSIONS
More terms from Michel Marcus, Aug 18 2022
STATUS
approved