I have permutation from $x$ to $y$.
And how to make sequence which $d$ summed numbers from this sequence ISN'T a prime number. if we have sequence $x_1,x_2,x_3,x_4,x_5 \dots y$ than $d$ means :
$x_1+x_2+ \dots +x_d$
next pair would be
$x_2+x_3+ \dots +x_{d+1}$
And so on.
for example: permutation from $1$ to $10$ and $d=2$
than we can make lowest lexicographically sequence which is :
$1,3,5,4,2,6,9,7,8,10$
for $x=1$ $y=10$ and $d=3$ we can have :
$1,3,5,4,6,2,10,8,7,9$
This problem is very interesting to me, thanks for any help.
Problem taken from : https://www.spoj.pl/problems/APRIME/
Cheers