login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A284697
Permutation of natural numbers: a(n) = (A073920(n) + 1) / 2.
0
1, 5, 8, 2, 11, 3, 13, 4, 6, 7, 14, 9, 17, 10, 12, 15, 18, 16, 20, 19, 21, 22, 23, 24, 27, 30, 31, 34, 25, 36, 26, 37, 40, 42, 45, 49, 28, 51, 52, 54, 29, 55, 32, 57, 64, 66, 33, 69, 70, 75, 76, 79, 35, 82, 84, 87, 90, 91, 38, 96, 39, 97, 99, 100, 106, 112, 41, 114, 115, 117
OFFSET
1,2
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
Cf. A073920.
Sequence in context: A199379 A198844 A156035 * A361221 A319261 A010489
KEYWORD
nonn
AUTHOR
Michel Marcus, Apr 01 2017
STATUS
approved