login
Permutation of natural numbers: a(n) = (A073920(n) + 1) / 2.
0

%I #8 Apr 02 2017 10:14:58

%S 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,

%T 31,34,25,36,26,37,40,42,45,49,28,51,52,54,29,55,32,57,64,66,33,69,70,

%U 75,76,79,35,82,84,87,90,91,38,96,39,97,99,100,106,112,41,114,115,117

%N Permutation of natural numbers: a(n) = (A073920(n) + 1) / 2.

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%o (PARI) nextcomposite(c) = until (!isprime(c), c +=2); c;

%o 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, ", "););}

%o (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_

%Y Cf. A073920.

%K nonn

%O 1,2

%A _Michel Marcus_, Apr 01 2017