mersenneforum.org  

Go Back   mersenneforum.org > Fun Stuff > Puzzles

Reply
 
Thread Tools
Old 2007-12-12, 13:36   #1
davar55
 
davar55's Avatar
 
May 2004
New York City

5·7·112 Posts
Default Decimation Sequences

Consider the first N positive integers arranged in a circular manner
so that 2 follows 1, 3 follows 2, ... , and 1 follows N.

Let M be any positive integer. Start counting at 1, and when you
reach M, note the number and remove it. Count M numbers again
(wrapping around when needed), note the number and remove it.
Continue in this way until all N numbers are removed.
The sequence of removed numbers is called a "decimation sequence"
on N generated by M.

(a) Show that every permutation on (1 thru N) is a decimation sequence
on N generated by some M in the range 1 <= M <= N! .

(b) Find the last number in the decimation sequence on N=10^12
generated by M=3.
davar55 is offline   Reply With Quote
Old 2007-12-12, 18:26   #2
davar55
 
davar55's Avatar
 
May 2004
New York City

5×7×112 Posts
Default

I must withdraw the claim of part (a).
It's easy to construct counterexamples.
The so-called argument I had to support it is flawed.
My apologies.

Perhaps the question can be rescued by asking instead
how many decimation sequences there are for any given N?
davar55 is offline   Reply With Quote
Old 2008-05-29, 20:02   #3
petrw1
1976 Toyota Corona years forever!
 
petrw1's Avatar
 
"Wayne"
Nov 2006
Saskatchewan, Canada

3×5×313 Posts
Default

706915036709

Brute force would never have finished.

I computed this in .001 seconds on my computer.

Last fiddled with by petrw1 on 2008-05-29 at 20:04
petrw1 is offline   Reply With Quote
Old 2008-05-29, 22:11   #4
petrw1
1976 Toyota Corona years forever!
 
petrw1's Avatar
 
"Wayne"
Nov 2006
Saskatchewan, Canada

3·5·313 Posts
Default

Quote:
Originally Posted by petrw1 View Post

I computed this in .001 seconds on my computer.
Algorithm available if I am correct ... otherwise the algorithm is obviously useless.
petrw1 is offline   Reply With Quote
Old 2008-06-11, 17:30   #5
petrw1
1976 Toyota Corona years forever!
 
petrw1's Avatar
 
"Wayne"
Nov 2006
Saskatchewan, Canada

3·5·313 Posts
Default I believe the proper protocol is ....

BUMP
petrw1 is offline   Reply With Quote
Old 2008-06-12, 13:33   #6
fivemack
(loop (#_fork))
 
fivemack's Avatar
 
Feb 2006
Cambridge, England

23×11×73 Posts
Default

I think this is called the Josephus Problem, and is discussed in an early chapter of Knuth's Concrete Mathematics; there's a bit of discussion at http://mathworld.wolfram.com/JosephusProblem.html without a useful algorithm, http://www.cut-the-knot.org/recurrence/j_solution.shtml is a bit closer to a useful algorithm.
fivemack is offline   Reply With Quote
Old 2008-06-16, 15:19   #7
petrw1
1976 Toyota Corona years forever!
 
petrw1's Avatar
 
"Wayne"
Nov 2006
Saskatchewan, Canada

3·5·313 Posts
Default

Not sure if I should have called it an algorithm as much as a formula or sequence for m=3.
Starting with the trivial cases:
Length (N) ... Ending Number (E)
1 ... 1
2 ... 2
3 ... 3
4 ... 1
Then...progressively add 1 to N and 3 to E. If E>N then E=E-N
While this work it still takes much too long for 10^12.

So I looked only at the points that E=1 or 2 and found a way to calculate it as:
IF E=2 AND N IS EVEN THEN N=N+CEILING(N/2)-1
ELSE N=N+CEILING(N/2)
IF N IS EVEN THEN E=3-E (This flips E from 2 to 1 OR 1 to 2)

Now the sequence displayed is:
Length (N) ... Ending Number (E)
4 ... 1
6 ... 1
9 ... 1
14 ... 2
21 ... 2
etc.

When I get to the point where the next N would be larger then 10^12 I compute the last E knowing that for each N+1 there is an E+3.

Then entire source in BASIC is (it runs in well under a second):
Quote:
defqud N,E
defdbl z
print 4;1
N=4
E=1
do while N*1.5<1000000000000
z=N/2
N=N+ceil(z)
if E=2 and z<>int(z) then N=N-1
if z<>int(z) then E=3-E
print N;E
loop

E=E+3*(1000000000000-N)
N=N+(1000000000000-N)
print N;E
petrw1 is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sequences >1M and < 5M ugly2dog Aliquot Sequences 21 2015-09-10 07:09
Two new sequences Mr. P-1 Factoring 16 2013-05-03 20:56
Any interest in all sequences/open sequences? Greebley Aliquot Sequences 6 2012-04-07 10:06
The Pi sequences Batalov Aliquot Sequences 7 2009-05-15 10:51
What are you using to run your sequences? 10metreh Aliquot Sequences 1 2009-04-05 08:11

All times are UTC. The time now is 20:39.


Fri Aug 6 20:39:47 UTC 2021 up 14 days, 15:08, 1 user, load averages: 2.52, 2.65, 2.79

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

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.