mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Puzzles (https://www.mersenneforum.org/forumdisplay.php?f=18)
-   -   April 2021 (https://www.mersenneforum.org/showthread.php?t=26665)

Kebbaj 2021-04-24 19:10

[QUOTE=Yusuf;]


The amount of steps and the amount of spins both equal to 7? No.


The amount of steps is = 7 .
The amount of spins is a variable.

Yusuf 2021-04-25 02:18

[QUOTE=Kebbaj;576761][QUOTE=Yusuf;]


The amount of steps and the amount of spins both equal to 7? No.


The amount of steps is = 7 .
The amount of spins is a variable.[/QUOTE]

But it says "the set is of size n-7", wouldn't that mean that there are 7 spins since there are 7 numbers being taken away from the wheel?

Dieter 2021-04-25 04:46

[QUOTE=Yusuf;576792][QUOTE=Kebbaj;576761]

But it says "the set is of size n-7", wouldn't that mean that there are 7 spins since there are 7 numbers being taken away from the wheel?[/QUOTE]

Yes. I'm sure that Kebbaj wanted to say this.

I repeat: Look at #2! That was my first comment to this challenge.

Or look at #8 (uau): "Those refer to different things with "step".

Seems that when the puzzlemaster formulated the real task ("your goal...") he had forgotten the definitions he had made at the beginning of the challenge.

"At each spin ... a number is eliminated from the wheel."

For the challenge without *, k=number of spins = 7.

uau 2021-05-04 22:37

Here's my solution. Just pretty straightforward brute force - enough for the sizes asked for in the question.

The program takes the size as input, so calling it with an argument of "7" gives the basic solution, "8" bonus one.

[CODE]#!/usr/bin/python3

from itertools import combinations
from math import lcm
import sys

def calc(n, q, s):
a = list(range(1, n+1))
for _ in range(s):
w = (q-1) % len(a)
a = a[w+1:] + a[:w]
a.sort()
return tuple(a)

turns = int(sys.argv[1])
for n in range(turns, 100):
print("Trying", n)
s = set()
for i in range(lcm(*range(n-turns+1, n+1))):
s.add(calc(n, i, turns))
r = s.symmetric_difference(set(combinations(range(1, n+1), n-turns)))
if r:
break
print(n)
print(len(r))
print(sorted(r))

[/CODE]


All times are UTC. The time now is 03:12.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.