Just wondering: "Note: G(N) is not defined for all values of N."

How can that be?

G(N) is the minimal drag distance.

Now *if* the numbers in the initial arrangement, when sorted, form a sequence without gaps and double values, it clearly is possible to drag them around to finally form one stack (just drag the [1] on the [2], then the [1+2] on the [3] and so on).

So there exists a candidate and upper bound for G(N) , and therefore also G(N).

The only thing I can think of, is that this suspect sequence: $ 3^n\bmod(N+1), 1\le n\le N $

may produce double values or gaps?

## Problem 750

**Forum rules**

As your posts will be visible to the general public you

are requested to be thoughtful in not posting anything

that might explicitly give away how to solve a particular problem.

This forum is NOT meant to discuss solution methods for a problem.

In particular don't post any code fragments or results.

Don't start begging others to give partial answers to problems

Don't ask for hints how to solve a problem

Don't start a new topic for a problem if there already exists one

Don't start begging others to give partial answers to problems

Don't ask for hints how to solve a problem

Don't start a new topic for a problem if there already exists one

See also the topics:

Don't post any spoilers

Comments, questions and clarifications about PE problems.

### Re: Problem 750

Ah, I see, basic number theory, cycle length of $ 3^k\bmod M , k=0,1,... $ should be $ M-1 $ (where M=N+1):

For this M may not contain a factor 3 -

then Euler's theorem tells us that $ \phi(M) $ is a upper bound (multiple) of cycle length,

and $ \phi(M) = M-1 $ iff M is prime.

So for G(N) to be defined, a

But what about a

For this M may not contain a factor 3 -

then Euler's theorem tells us that $ \phi(M) $ is a upper bound (multiple) of cycle length,

and $ \phi(M) = M-1 $ iff M is prime.

So for G(N) to be defined, a

**condition is that***necessary***M=N+1 is prime**.But what about a

**condition ??***sufficient*### Re: Problem 750

You're correct that $N+1$ must be prime.deWalk wrote: ↑Sun Mar 07, 2021 9:29 pm Ah, I see, basic number theory, cycle length of $ 3^k\bmod M , k=0,1,... $ should be $ M-1 $ (where M=N+1):

For this M may not contain a factor 3 -

then Euler's theorem tells us that $ \phi(M) $ is a upper bound (multiple) of cycle length,

and $ \phi(M) = M-1 $ iff M is prime.

So for G(N) to be defined, acondition is thatnecessaryM=N+1 is prime.

But what about acondition ??sufficient

The extra condition that needs satisfying is $3$ to be a generator of the multiplicative group mod $(N+1)$, which holds iff $3^{N/p} \not\equiv 1 \mod (N+1)$ for all prime factors $p$ of $N$.