# [seqfan] Jumping back and forth (primes and composites)

Eric Angelini Eric.Angelini at kntv.be
Sat Apr 14 23:53:33 CEST 2012

```Hello SeqFans,
The hereunder seq V is the beginning
of the permutation of the Naturals, I was looking for, I hope:
V = 1,6,4,10,8,9,14,5,3,26,18,12,22,7,2,11,27,16,34,38,58,15,24,44,17,52,63,38,68,20,46,32,69,50,23,21,13,19,... (I'm not sure that the four terms >57 are correct)

The idea is to start on a(1)=1 and from there:
-- if a(n) is not prime, then jump to the right over a(n) terms;
-- if a(n) is prime, then jump to the left over a(n) terms;
-- the term you land on will be the starting point for the next jump.

I think V is the lexicographically first such seq if, in extending V, one always tries to fill the leftmost "hole" with an integer not yet present in U and not leading to a contradiction.

To build this from scratch,
I've obeyed the following
procedure:
- start from a(1)=1 and jump to the right;
- a jump is only permitted if
the landing square is free;
- when you've landed on a free
square, try to fill the said square with the biggest prime
not used so far and < to the
rank n of the said square in V,
provided that this prime points
itself towards another free square;
- else fill the said square with
the smallest composite not used
so far and  pointing itself towards
another free square;

Example:

V = 1 . . . . . . .
V = 1 . 4 . . . . .
after jumping to the right from 1,
the landing square (where the 4 is
now) cannot be occupied by a
prime number (which would then
point towards an unexisting square);
thus we must use 4, the
smallest
available composite; we proceed
from there:

V = 1 . 4 . . . . 5

the rank of 5 in V is n = 8;
the biggest prime < 8 is 7, yes,
but 7 would lead to a contradiction
(we cannot write ahead of the
first term, 1). Instead of 7 we
then try 5 (the next available
prime < 8) -- which is ok because
5 points towards a free square;
we then proceed from there with 6:

V = 1 6 4 . . . . 5 . . .

we fill the free square between
1 and 4 with 6 as we cannot use
a prime instead -- and because 6 is
the smallest available composite pointing towards a free square;
3 will come next:

V = 1 6 4 . . . . 5 3 . .

jumping from 6 makes you land
on an free square which must
be filled (as usual) by the biggest
available prime < 9 (9 being the
rank of the said free square in V)
-- and this available prime is 3, which
correctly points towards another free
square; etc.

V = 1 6 4 . . 9 . 5 3 . .

Best,
É.

Envoyé d'un aPhone

```