• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 09:02
CEST 15:02
KST 22:02
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Serral wins EWC 202543Tournament Spotlight: FEL Cracow 202510Power Rank - Esports World Cup 202580RSL Season 1 - Final Week9[ASL19] Finals Recap: Standing Tall15
Community News
Weekly Cups (Jul 28-Aug 3): herO doubles up6LiuLi Cup - August 2025 Tournaments3[BSL 2025] H2 - Team Wars, Weeklies & SB Ladder10EWC 2025 - Replay Pack4Google Play ASL (Season 20) Announced58
StarCraft 2
General
Weekly Cups (Jul 28-Aug 3): herO doubles up Clem Interview: "PvT is a bit insane right now" Serral wins EWC 2025 TL Team Map Contest #5: Presented by Monster Energy Would you prefer the game to be balanced around top-tier pro level or average pro level?
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays $5,000 WardiTV Summer Championship 2025 LiuLi Cup - August 2025 Tournaments Sea Duckling Open (Global, Bronze-Diamond)
Strategy
Custom Maps
External Content
Mutation # 485 Death from Below Mutation # 484 Magnetic Pull Mutation #239 Bad Weather Mutation # 483 Kill Bot Wars
Brood War
General
BW General Discussion Help, I can't log into staredit.net How do the new Battle.net ranks translate? Which top zerg/toss will fail in qualifiers? Google Play ASL (Season 20) Announced
Tourneys
[Megathread] Daily Proleagues [ASL20] Online Qualifiers Day 2 Cosmonarchy Pro Showmatches [ASL20] Online Qualifiers Day 1
Strategy
Simple Questions, Simple Answers [G] Mineral Boosting Muta micro map competition Does 1 second matter in StarCraft?
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Total Annihilation Server - TAForever Beyond All Reason [MMORPG] Tree of Savior (Successor of Ragnarok)
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine European Politico-economics QA Mega-thread Bitcoin discussion thread 9/11 Anniversary
Fan Clubs
INnoVation Fan Club SKT1 Classic Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread [\m/] Heavy Metal Thread Korean Music Discussion
Sports
2024 - 2025 Football Thread Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Gtx660 graphics card replacement Installation of Windows 10 suck at "just a moment" Computer Build, Upgrade & Buying Resource Thread
TL Community
TeamLiquid Team Shirt On Sale The Automated Ban List
Blogs
[Girl blog} My fema…
artosisisthebest
Sharpening the Filtration…
frozenclaw
ASL S20 English Commentary…
namkraft
The Link Between Fitness and…
TrAiDoS
momentary artworks from des…
tankgirl
from making sc maps to makin…
Husyelt
Customize Sidebar...

Website Feedback

Closed Threads



Active: 902 users

Math Problem: Placing Numbers

Blogs > micronesia
Post a Reply
Normal
micronesia
Profile Blog Joined July 2006
United States24682 Posts
July 02 2009 20:05 GMT
#1
Someone I met on irc proposed a math problem and asked me to help him construct a computer program to solve it. I have some ideas about how to make the code, but I don't have the time to try to make the program, and he is a coding beginner so he can't do it himself. I can't think of any way to solve it without a computer, but I'd love to offer the problem to the community.

The Problem: (proposed by Joseph)

Imagine nine boxes equally spaced along the perimeter of a circle. We'll call the top-most position position #1. The next position clockwise is position #2, etc. through to #9. The goal is to place the numbers 1-9 in the boxes such that they obey the following:

If you place the number 3 in position one, then you have to count 3 boxes clockwise and place the next number in position 4. Then, if you put a '2' in that box your next number would have to go in position 6, etc. Essentially, if you place a number n in a box, then your next number goes n places clockwise from that position. You need to place 1-8 such that they don't overlap and previous numbers, and then 9 goes in the final position.

Solutions?

How many, if any, possible sequences of numbers can you use in order to solve this? Is there a mathematical way to solve it without using a computer program? If not, how would you construct a program to do this?

Disclaimer: this problem is for pure intellectual curiosity and is not assigned work

****
ModeratorThere are animal crackers for people and there are people crackers for animals.
Pawsom
Profile Blog Joined February 2009
United States928 Posts
July 02 2009 20:26 GMT
#2
Seems like a fairly straightforward backtracking problem unless I'm missing something.
Dromar
Profile Blog Joined June 2007
United States2145 Posts
July 02 2009 20:30 GMT
#3
My solution:

+ Show Spoiler +
Not possible. Since 9 would make a full circle and land on itself, it must be placed last. That means 1-8 must be placed first, but 1-8 sum up to 36, which is a multiple of 9, and so after placing the first 8 numbers, you will land on the first square you started at, which already has a number.
Pawsom
Profile Blog Joined February 2009
United States928 Posts
July 02 2009 20:30 GMT
#4
On July 03 2009 05:30 Dromar wrote:
My solution:

+ Show Spoiler +
Not possible. Since 9 would make a full circle and land on itself, it must be placed last. That means 1-8 must be placed first, but 1-8 sum up to 36, which is a multiple of 9, and so after placing the first 8 numbers, you will land on the first square you started at, which already has a number.


You need to place 1-8 such that they don't overlap and previous numbers, and then 9 goes in the final position.
Dromar
Profile Blog Joined June 2007
United States2145 Posts
Last Edited: 2009-07-02 20:37:58
July 02 2009 20:34 GMT
#5
On July 03 2009 05:30 Pawsom wrote:
Show nested quote +
On July 03 2009 05:30 Dromar wrote:
My solution:

+ Show Spoiler +
Not possible. Since 9 would make a full circle and land on itself, it must be placed last. That means 1-8 must be placed first, but 1-8 sum up to 36, which is a multiple of 9, and so after placing the first 8 numbers, you will land on the first square you started at, which already has a number.


You need to place 1-8 such that they don't overlap and previous numbers, and then 9 goes in the final position.


I'm aware.

+ Show Spoiler +
After placing the first 8 in such a manner, your only possible outcome is to have jumped 36 spaces, landing on an already filled space (specifically, the one you started on).


+ Show Spoiler +
In fact, this is impossible not for just 9 boxes and numbers 1-9, but for any number n boxes and numbers 1-n where n is odd. The proof is is simple as showing that for any n odd, the sum of 1 through (n-1) mod n is 0
micronesia
Profile Blog Joined July 2006
United States24682 Posts
July 02 2009 20:34 GMT
#6
Dromar I think you are correct. It makes sense.
ModeratorThere are animal crackers for people and there are people crackers for animals.
Pawsom
Profile Blog Joined February 2009
United States928 Posts
Last Edited: 2009-07-02 20:40:09
July 02 2009 20:35 GMT
#7
Ah I see what you mean. Silly me!

Looking at this further, there are only 8 possible solutions.

1 2 _ 3 _ _ 4 _ _. And here the five would "land" on the two. So four must be placed before two.

3 _ _ 4 _ _ _ 5 _. And here the six would land on the four. So six must be placed before five.

6 _ _ 9 8 _ 7 _ _. And here the nine lands on itself. Which brings us to what Dromar said about 9 having to be placed last.
armed_
Profile Joined November 2008
Canada443 Posts
July 02 2009 20:35 GMT
#8
Yeah, unless you described something wrong, Dromar's right.
TanGeng
Profile Blog Joined January 2009
Sanya12364 Posts
Last Edited: 2009-07-02 21:05:45
July 02 2009 21:02 GMT
#9
Partial Solution:
I'm not going to tackle the computer programming portion just yet.

+ Show Spoiler +

The goal is to produce a sequence that produces a partial sum value that is always a different modulo with respect to 9 at all points in the series.

First of all the sum of 1-8 is 36 which is a multiple of 9 - equivalent of modulo 0.

Since the sequence always returns to the first position at the end, the sequence is cyclical. The starting point of any sequence that works doesn't matter. Inversion of the order also only results in inversion of the sign with respect to modulo, resulting in yet another valid sequence.

For example:
8-2-6-4-3-7-1-5 works so
2-6-4-3-7-1-5-8 also works and
5-1-7-3-4-6-2-8 also works

There's 16 derived solutions coming out of any one unique cycle.

This can be seen as creating 2 unique cyclical paths around the circle. One consisting of just the number 9, and one consisting of 1-8.
Moderator我们是个踏实的赞助商模式俱乐部
vAltyR
Profile Blog Joined July 2008
United States581 Posts
July 02 2009 21:14 GMT
#10
On July 03 2009 06:02 TanGeng wrote:
Partial Solution:
I'm not going to tackle the computer programming portion just yet.

+ Show Spoiler +

The goal is to produce a sequence that produces a partial sum value that is always a different modulo with respect to 9 at all points in the series.

First of all the sum of 1-8 is 36 which is a multiple of 9 - equivalent of modulo 0.

Since the sequence always returns to the first position at the end, the sequence is cyclical. The starting point of any sequence that works doesn't matter. Inversion of the order also only results in inversion of the sign with respect to modulo, resulting in yet another valid sequence.

For example:
8-2-6-4-3-7-1-5 works so
2-6-4-3-7-1-5-8 also works and
5-1-7-3-4-6-2-8 also works

There's 16 derived solutions coming out of any one unique cycle.

This can be seen as creating 2 unique cyclical paths around the circle. One consisting of just the number 9, and one consisting of 1-8.


Where does 9 lie in your given solutions? Unless I missed something, that needs to be included as well.
내 호버크라프트는 장어로 가득 차 있어요
TanGeng
Profile Blog Joined January 2009
Sanya12364 Posts
July 02 2009 21:17 GMT
#11
On July 03 2009 06:14 vAltyR wrote:
Show nested quote +
On July 03 2009 06:02 TanGeng wrote:
Partial Solution:
I'm not going to tackle the computer programming portion just yet.

+ Show Spoiler +

The goal is to produce a sequence that produces a partial sum value that is always a different modulo with respect to 9 at all points in the series.

First of all the sum of 1-8 is 36 which is a multiple of 9 - equivalent of modulo 0.

Since the sequence always returns to the first position at the end, the sequence is cyclical. The starting point of any sequence that works doesn't matter. Inversion of the order also only results in inversion of the sign with respect to modulo, resulting in yet another valid sequence.

For example:
8-2-6-4-3-7-1-5 works so
2-6-4-3-7-1-5-8 also works and
5-1-7-3-4-6-2-8 also works

There's 16 derived solutions coming out of any one unique cycle.

This can be seen as creating 2 unique cyclical paths around the circle. One consisting of just the number 9, and one consisting of 1-8.

Where does 9 lie in your given solutions? Unless I missed something, that needs to be included as well.

1-8 is part of one cycle. 9 is its own cycle. That's how the problem is posed. There is no need to worry about 9 since it'll just occupy the only space that remains.
Moderator我们是个踏实的赞助商模式俱乐部
Dromar
Profile Blog Joined June 2007
United States2145 Posts
July 02 2009 21:20 GMT
#12
On July 03 2009 06:17 TanGeng wrote:
Show nested quote +
On July 03 2009 06:14 vAltyR wrote:
On July 03 2009 06:02 TanGeng wrote:
Partial Solution:
I'm not going to tackle the computer programming portion just yet.

+ Show Spoiler +

The goal is to produce a sequence that produces a partial sum value that is always a different modulo with respect to 9 at all points in the series.

First of all the sum of 1-8 is 36 which is a multiple of 9 - equivalent of modulo 0.

Since the sequence always returns to the first position at the end, the sequence is cyclical. The starting point of any sequence that works doesn't matter. Inversion of the order also only results in inversion of the sign with respect to modulo, resulting in yet another valid sequence.

For example:
8-2-6-4-3-7-1-5 works so
2-6-4-3-7-1-5-8 also works and
5-1-7-3-4-6-2-8 also works

There's 16 derived solutions coming out of any one unique cycle.

This can be seen as creating 2 unique cyclical paths around the circle. One consisting of just the number 9, and one consisting of 1-8.

Where does 9 lie in your given solutions? Unless I missed something, that needs to be included as well.

1-8 is part of one cycle. 9 is its own cycle. That's how the problem is posed. There is no need to worry about 9 since it'll just occupy the only space that remains.


There is one worry: you need to land on that "only space" in order to place the 9 there.
TanGeng
Profile Blog Joined January 2009
Sanya12364 Posts
July 02 2009 21:22 GMT
#13
On July 03 2009 06:20 Dromar wrote:
Show nested quote +
On July 03 2009 06:17 TanGeng wrote:
On July 03 2009 06:14 vAltyR wrote:
On July 03 2009 06:02 TanGeng wrote:
Partial Solution:
I'm not going to tackle the computer programming portion just yet.

+ Show Spoiler +

The goal is to produce a sequence that produces a partial sum value that is always a different modulo with respect to 9 at all points in the series.

First of all the sum of 1-8 is 36 which is a multiple of 9 - equivalent of modulo 0.

Since the sequence always returns to the first position at the end, the sequence is cyclical. The starting point of any sequence that works doesn't matter. Inversion of the order also only results in inversion of the sign with respect to modulo, resulting in yet another valid sequence.

For example:
8-2-6-4-3-7-1-5 works so
2-6-4-3-7-1-5-8 also works and
5-1-7-3-4-6-2-8 also works

There's 16 derived solutions coming out of any one unique cycle.

This can be seen as creating 2 unique cyclical paths around the circle. One consisting of just the number 9, and one consisting of 1-8.

Where does 9 lie in your given solutions? Unless I missed something, that needs to be included as well.

1-8 is part of one cycle. 9 is its own cycle. That's how the problem is posed. There is no need to worry about 9 since it'll just occupy the only space that remains.


There is one worry: you need to land on that "only space" in order to place the 9 there.

9 goes in the final position - the only one that remains. There is no stipulation that the 8th number in the sequence leads you to where you need to place 9.
Moderator我们是个踏实的赞助商模式俱乐部
cichli
Profile Joined August 2006
Sweden84 Posts
Last Edited: 2009-07-02 22:20:46
July 02 2009 21:31 GMT
#14
Placing numbers 1 to 9 on a circle according to your description has been solved by others on this thread, but if we generalize the problem to sequence of length n rather than length 9, we find the following solutions:

+ Show Spoiler +

Numbers 1-1 has one solution:
- [1]
Numbers 1-2 has one solutions:
- [1, 2]
Numbers 1-3 has no solutions.
Numbers 1-4 has two solutions:
- [1, 2, 4, 3]
- [3, 1, 4, 2]
Numbers 1-5 has no solutions.
Numbers 1-6 has four solutions:
- [1, 4, 2, 6, 5, 3]
- [2, 3, 5, 6, 1, 4]
- [4, 2, 5, 6, 1, 3]
- [5, 3, 1, 6, 4, 2]
Numbers 1-7 has no solutions.
Numbers 1-8 has 24 solutions:
- [1, 2, 5, 3, 8, 7, 4, 6]
- [1, 5, 2, 4, 8, 6, 7, 3]
- [1, 6, 2, 3, 8, 5, 7, 4]
- [1, 6, 4, 2, 8, 7, 5, 3]
- [2, 4, 5, 1, 8, 6, 3, 7]
- [2, 4, 7, 3, 8, 6, 1, 5]
- [2, 6, 1, 3, 8, 4, 7, 5]
- [2, 6, 3, 1, 8, 4, 5, 7]
- [3, 1, 4, 6, 8, 2, 7, 5]
- [3, 1, 5, 2, 8, 4, 6, 7]
- [3, 4, 5, 7, 8, 1, 6, 2]
- [3, 6, 7, 2, 8, 1, 4, 5]
- [5, 1, 2, 4, 8, 6, 3, 7]
- [5, 3, 1, 6, 8, 2, 4, 7]
- [5, 3, 4, 7, 8, 6, 1, 2]
- [5, 6, 2, 7, 8, 1, 3, 4]
- [6, 1, 3, 4, 8, 7, 5, 2]
- [6, 1, 5, 2, 8, 7, 3, 4]
- [6, 3, 1, 4, 8, 5, 7, 2]
- [6, 3, 7, 2, 8, 5, 1, 4]
- [7, 2, 4, 1, 8, 5, 3, 6]
- [7, 4, 1, 3, 8, 5, 6, 2]
- [7, 5, 1, 2, 8, 4, 6, 3]
- [7, 5, 3, 1, 8, 6, 4, 2]


I solved this by writing a simple SML program that does it by brute force: for each permutation of the numbers 1 through n, check if it's a valid sequence as defined in this thread. Thus, I ran out of memory when I tried solving it for sequence size 10 or larger.

Interesting observation:

+ Show Spoiler +

It seems that so far, only even sequence sizes yield solutions. Perhaps this holds some useful clue to the nature of these sequences?
The Internet will not listen to reason
coltrane
Profile Blog Joined June 2008
Chile988 Posts
July 02 2009 21:42 GMT
#15
Im gonna check this using group algebra, then in something about half an hour i can give you a good solution aplicable to summative groups of n elements...
Jävla skit
micronesia
Profile Blog Joined July 2006
United States24682 Posts
July 02 2009 22:14 GMT
#16
On July 03 2009 06:22 TanGeng wrote:
Show nested quote +
On July 03 2009 06:20 Dromar wrote:
On July 03 2009 06:17 TanGeng wrote:
On July 03 2009 06:14 vAltyR wrote:
On July 03 2009 06:02 TanGeng wrote:
Partial Solution:
I'm not going to tackle the computer programming portion just yet.

+ Show Spoiler +

The goal is to produce a sequence that produces a partial sum value that is always a different modulo with respect to 9 at all points in the series.

First of all the sum of 1-8 is 36 which is a multiple of 9 - equivalent of modulo 0.

Since the sequence always returns to the first position at the end, the sequence is cyclical. The starting point of any sequence that works doesn't matter. Inversion of the order also only results in inversion of the sign with respect to modulo, resulting in yet another valid sequence.

For example:
8-2-6-4-3-7-1-5 works so
2-6-4-3-7-1-5-8 also works and
5-1-7-3-4-6-2-8 also works

There's 16 derived solutions coming out of any one unique cycle.

This can be seen as creating 2 unique cyclical paths around the circle. One consisting of just the number 9, and one consisting of 1-8.

Where does 9 lie in your given solutions? Unless I missed something, that needs to be included as well.

1-8 is part of one cycle. 9 is its own cycle. That's how the problem is posed. There is no need to worry about 9 since it'll just occupy the only space that remains.


There is one worry: you need to land on that "only space" in order to place the 9 there.

9 goes in the final position - the only one that remains. There is no stipulation that the 8th number in the sequence leads you to where you need to place 9.

I think I was unclear in describing the problem. Although I didn't come up with it, I think the 9 is supposed to be landed on as a result of placing 8.
ModeratorThere are animal crackers for people and there are people crackers for animals.
ReMiiX
Profile Blog Joined April 2009
United States338 Posts
July 02 2009 22:18 GMT
#17
The code would be easy to do. PM me and we should discuss. My main language is Java but I do C++ and Python also. And this other thing called Fortran, stupid punch cards.
GaTech CSL fighting!
Crunchums
Profile Blog Joined December 2008
United States11144 Posts
July 02 2009 22:43 GMT
#18
It's not possible, Dromar is 100% correct.
brood war for life, brood war forever
cichli
Profile Joined August 2006
Sweden84 Posts
July 02 2009 23:13 GMT
#19
On July 03 2009 07:14 micronesia wrote:
Show nested quote +
On July 03 2009 06:22 TanGeng wrote:
9 goes in the final position - the only one that remains. There is no stipulation that the 8th number in the sequence leads you to where you need to place 9.

I think I was unclear in describing the problem. Although I didn't come up with it, I think the 9 is supposed to be landed on as a result of placing 8.


When you say 8 here, are you referring to the 8th number in the sequence, or the actual number 8? If you mean the actual number 8, does this also generalize so that the number n must be landed on as a result of placing n-1?
The Internet will not listen to reason
micronesia
Profile Blog Joined July 2006
United States24682 Posts
July 02 2009 23:53 GMT
#20
On July 03 2009 08:13 cichli wrote:
Show nested quote +
On July 03 2009 07:14 micronesia wrote:
On July 03 2009 06:22 TanGeng wrote:
9 goes in the final position - the only one that remains. There is no stipulation that the 8th number in the sequence leads you to where you need to place 9.

I think I was unclear in describing the problem. Although I didn't come up with it, I think the 9 is supposed to be landed on as a result of placing 8.


When you say 8 here, are you referring to the 8th number in the sequence, or the actual number 8? If you mean the actual number 8, does this also generalize so that the number n must be landed on as a result of placing n-1?

I meant 9 should be placed as a result of laying all numbers 1-8 in any order.... 8 could be first or fifth it don't matter.
ModeratorThere are animal crackers for people and there are people crackers for animals.
coltrane
Profile Blog Joined June 2008
Chile988 Posts
Last Edited: 2009-07-03 00:02:27
July 02 2009 23:58 GMT
#21
ok, lets begin...

You are working in the additive quotient group Z/9Z, therefore 9 is equivalent to 0, the additive neutro.

So, as said you cant use it until the last step, he completes the cicle.

Moreover, in any partial of the sumatory it cant be a multiple of 9.

Actually is a little bit more on it. When you use a slot, any of them, you are using the whole class, so when you use in example the 5 you cannot get any partial on a nine multiple plus 5.

This limits us as hell, but, is a start.

Let me work in a correct method to do this and some lections to extend this to Z/nZ, i suppose i will have to use ciclic groups and subgroups, but at the last i will be able to do it really fast with any group that has a solution and know just by looking if some n doesnt have it with proofs of it.


edit: so, that last thing should do for a simple coding, you take the sum, make a mod(9) (the rest of the integer divition) of it and if you get any number alredy picked then chose the next number....
Jävla skit
Cambium
Profile Blog Joined June 2004
United States16368 Posts
July 03 2009 00:18 GMT
#22
On July 03 2009 06:31 cichli wrote:
Placing numbers 1 to 9 on a circle according to your description has been solved by others on this thread, but if we generalize the problem to sequence of length n rather than length 9, we find the following solutions:

+ Show Spoiler +

Numbers 1-1 has one solution:
- [1]
Numbers 1-2 has one solutions:
- [1, 2]
Numbers 1-3 has no solutions.
Numbers 1-4 has two solutions:
- [1, 2, 4, 3]
- [3, 1, 4, 2]
Numbers 1-5 has no solutions.
Numbers 1-6 has four solutions:
- [1, 4, 2, 6, 5, 3]
- [2, 3, 5, 6, 1, 4]
- [4, 2, 5, 6, 1, 3]
- [5, 3, 1, 6, 4, 2]
Numbers 1-7 has no solutions.
Numbers 1-8 has 24 solutions:
- [1, 2, 5, 3, 8, 7, 4, 6]
- [1, 5, 2, 4, 8, 6, 7, 3]
- [1, 6, 2, 3, 8, 5, 7, 4]
- [1, 6, 4, 2, 8, 7, 5, 3]
- [2, 4, 5, 1, 8, 6, 3, 7]
- [2, 4, 7, 3, 8, 6, 1, 5]
- [2, 6, 1, 3, 8, 4, 7, 5]
- [2, 6, 3, 1, 8, 4, 5, 7]
- [3, 1, 4, 6, 8, 2, 7, 5]
- [3, 1, 5, 2, 8, 4, 6, 7]
- [3, 4, 5, 7, 8, 1, 6, 2]
- [3, 6, 7, 2, 8, 1, 4, 5]
- [5, 1, 2, 4, 8, 6, 3, 7]
- [5, 3, 1, 6, 8, 2, 4, 7]
- [5, 3, 4, 7, 8, 6, 1, 2]
- [5, 6, 2, 7, 8, 1, 3, 4]
- [6, 1, 3, 4, 8, 7, 5, 2]
- [6, 1, 5, 2, 8, 7, 3, 4]
- [6, 3, 1, 4, 8, 5, 7, 2]
- [6, 3, 7, 2, 8, 5, 1, 4]
- [7, 2, 4, 1, 8, 5, 3, 6]
- [7, 4, 1, 3, 8, 5, 6, 2]
- [7, 5, 1, 2, 8, 4, 6, 3]
- [7, 5, 3, 1, 8, 6, 4, 2]


I solved this by writing a simple SML program that does it by brute force: for each permutation of the numbers 1 through n, check if it's a valid sequence as defined in this thread. Thus, I ran out of memory when I tried solving it for sequence size 10 or larger.

Interesting observation:

+ Show Spoiler +

It seems that so far, only even sequence sizes yield solutions. Perhaps this holds some useful clue to the nature of these sequences?


Did you try working out your solution by hand?

I tried one:
- [1, 2, 5, 3, 8, 7, 4, 6] and it doesn't work

It fails on 8...
When you want something, all the universe conspires in helping you to achieve it.
Cambium
Profile Blog Joined June 2004
United States16368 Posts
Last Edited: 2009-07-03 00:49:19
July 03 2009 00:20 GMT
#23
Solution to the original problem (assuming you can place 9 anywhere...):
+ Show Spoiler +

Sequence of insertions (initial position does not matter, obviously)
->1->2->8->6->5->3->7->4
->1->2->8->5->6->4->7->3
->1->2->3->5->6->8->7->4
->1->2->5->8->6->7->4->3
->1->2->5->8->6->7->3->4
->1->2->5->8->7->6->4->3
->1->2->5->6->8->3->4->7
->1->2->5->6->8->7->4->3
->1->4->2->8->6->5->3->7
->1->4->2->6->8->3->5->7
->1->4->2->6->8->5->3->7
->1->4->2->6->8->5->7->3
->1->4->2->5->8->6->7->3
->1->4->8->2->6->5->3->7
->1->4->6->2->8->5->7->3
->1->4->3->8->6->2->5->7
->1->4->3->7->6->8->2->5
->1->4->3->7->6->8->5->2
->1->4->3->7->5->2->8->6
->1->4->3->5->2->6->8->7
->1->4->7->8->6->5->2->3
->1->4->7->8->6->5->3->2
->1->4->7->8->5->6->2->3
->1->4->7->3->2->8->6->5
->1->4->7->3->5->6->8->2
->1->4->7->5->8->6->2->3
->1->6->4->2->8->5->7->3
->1->6->8->2->5->7->3->4
->1->6->7->3->4->8->2->5
->1->6->5->2->8->4->3->7
->1->6->5->2->8->4->7->3
->1->6->5->2->8->7->4->3
->1->6->5->8->2->4->7->3
->1->3->2->6->8->5->7->4
->1->3->2->6->5->8->4->7
->1->3->2->6->5->8->7->4
->1->3->2->5->6->8->7->4
->1->3->4->8->5->2->6->7
->1->3->4->6->2->8->5->7
->1->3->4->6->2->5->8->7
->1->3->4->6->7->8->5->2
->1->3->4->7->8->2->5->6
->1->3->4->7->8->6->5->2
->1->3->4->7->6->8->5->2
->1->3->8->5->6->2->4->7
->1->3->7->4->2->8->5->6
->1->3->7->4->8->2->5->6
->1->3->7->4->6->5->8->2
->1->3->7->6->8->5->2->4
->1->3->7->5->8->2->4->6
->1->3->7->5->8->2->6->4
->1->3->7->5->8->6->2->4
->1->7->4->2->6->5->8->3
->1->7->4->8->3->2->6->5
->1->7->4->8->5->6->2->3
->1->7->4->3->8->2->6->5
->1->7->4->3->8->6->2->5
->1->7->4->3->8->6->5->2
->1->7->8->6->2->5->3->4
->1->7->8->5->2->6->4->3
->1->7->6->2->5->8->4->3
->1->7->3->4->8->2->6->5
->1->7->3->4->8->2->5->6
->1->7->3->4->6->2->8->5
->1->7->3->5->8->6->2->4
->1->7->3->5->6->2->8->4
->1->7->3->5->6->8->2->4
->1->7->5->2->6->8->3->4
->1->7->5->8->2->6->4->3
->1->7->5->3->8->6->2->4
->1->5->2->8->4->3->7->6
->1->5->2->8->6->7->3->4
->1->5->2->6->8->3->4->7
->1->5->8->2->6->4->3->7
->1->5->6->2->8->4->3->7
->1->5->6->2->8->3->4->7
->1->5->6->2->3->8->4->7
->1->5->6->8->2->3->7->4
->2->4->6->1->3->7->5->8
->2->4->1->3->7->6->8->5
->2->4->1->3->7->5->8->6
->2->4->1->7->3->5->8->6
->2->4->1->7->3->5->6->8
->2->4->1->7->5->3->8->6
->2->4->7->1->3->8->5->6
->2->4->7->3->1->6->5->8
->2->8->4->1->7->3->5->6
->2->8->4->3->7->6->1->5
->2->8->4->3->7->1->6->5
->2->8->4->3->7->1->5->6
->2->8->4->7->3->1->6->5
->2->8->6->1->4->3->7->5
->2->8->6->7->3->4->1->5
->2->8->6->5->1->4->7->3
->2->8->6->5->3->7->4->1
->2->8->6->5->3->7->1->4
->2->8->3->4->7->1->5->6
->2->8->7->4->3->1->6->5
->2->8->5->6->4->7->3->1
->2->8->5->6->1->3->7->4
->2->8->5->1->7->3->4->6
->2->8->5->7->1->3->4->6
->2->8->5->7->3->1->4->6
->2->8->5->7->3->1->6->4
->2->6->4->1->3->7->5->8
->2->6->4->3->1->7->8->5
->2->6->4->3->1->7->5->8
->2->6->4->3->7->1->5->8
->2->6->8->3->4->1->7->5
->2->6->8->3->4->7->1->5
->2->6->8->3->5->7->1->4
->2->6->8->7->1->4->3->5
->2->6->8->5->3->7->1->4
->2->6->8->5->7->4->1->3
->2->6->8->5->7->3->1->4
->2->6->7->1->3->4->8->5
->2->6->5->8->4->7->1->3
->2->6->5->8->3->1->7->4
->2->6->5->8->7->4->1->3
->2->6->5->1->7->4->8->3
->2->6->5->1->7->4->3->8
->2->6->5->1->7->3->4->8
->2->6->5->3->7->1->4->8
->2->1->4->3->7->6->8->5
->2->1->4->7->8->6->5->3
->2->1->4->7->3->5->6->8
->2->1->3->4->6->7->8->5
->2->1->3->4->7->8->6->5
->2->1->3->4->7->6->8->5
->2->1->3->7->4->6->5->8
->2->1->7->4->3->8->6->5
->2->3->8->4->7->1->5->6
->2->3->1->4->7->8->6->5
->2->3->1->4->7->8->5->6
->2->3->1->4->7->5->8->6
->2->3->1->7->4->8->5->6
->2->3->7->4->1->5->6->8
->2->3->5->6->8->7->4->1
->2->5->8->4->3->1->7->6
->2->5->8->6->7->4->3->1
->2->5->8->6->7->3->4->1
->2->5->8->6->7->3->1->4
->2->5->8->7->6->4->3->1
->2->5->8->7->1->3->4->6
->2->5->6->8->3->4->7->1
->2->5->6->8->7->4->1->3
->2->5->6->8->7->4->3->1
->2->5->6->1->3->4->7->8
->2->5->6->1->3->7->4->8
->2->5->6->1->7->3->4->8
->2->5->1->4->3->7->6->8
->2->5->1->6->7->3->4->8
->2->5->1->7->4->3->8->6
->2->5->3->4->1->7->8->6
->2->5->7->1->4->3->8->6
->2->5->7->3->4->1->6->8
->3->2->8->6->5->1->4->7
->3->2->6->8->5->7->4->1
->3->2->6->5->8->4->7->1
->3->2->6->5->8->7->4->1
->3->2->6->5->1->7->4->8
->3->2->1->4->7->8->6->5
->3->2->5->6->8->7->4->1
->3->4->8->2->6->5->1->7
->3->4->8->2->5->6->1->7
->3->4->8->2->5->1->6->7
->3->4->8->5->2->6->7->1
->3->4->6->2->8->5->1->7
->3->4->6->2->8->5->7->1
->3->4->6->2->5->8->7->1
->3->4->6->7->8->5->2->1
->3->4->1->2->5->8->6->7
->3->4->1->6->8->2->5->7
->3->4->1->7->8->6->2->5
->3->4->1->7->5->2->6->8
->3->4->1->5->2->8->6->7
->3->4->7->8->2->5->6->1
->3->4->7->8->6->5->2->1
->3->4->7->6->8->5->2->1
->3->4->7->1->2->5->6->8
->3->4->7->1->5->2->6->8
->3->4->7->1->5->6->2->8
->3->8->2->6->5->1->7->4
->3->8->4->7->1->5->6->2
->3->8->6->2->4->1->7->5
->3->8->6->2->5->1->7->4
->3->8->6->2->5->7->1->4
->3->8->6->5->2->1->7->4
->3->8->5->6->2->4->7->1
->3->1->2->8->5->6->4->7
->3->1->2->5->8->6->7->4
->3->1->2->5->8->7->6->4
->3->1->2->5->6->8->7->4
->3->1->4->2->6->8->5->7
->3->1->4->2->5->8->6->7
->3->1->4->6->2->8->5->7
->3->1->4->7->8->6->5->2
->3->1->4->7->8->5->6->2
->3->1->4->7->5->8->6->2
->3->1->6->4->2->8->5->7
->3->1->6->5->2->8->4->7
->3->1->6->5->2->8->7->4
->3->1->6->5->8->2->4->7
->3->1->7->4->2->6->5->8
->3->1->7->4->8->5->6->2
->3->1->7->8->5->2->6->4
->3->1->7->6->2->5->8->4
->3->1->7->5->8->2->6->4
->3->7->4->2->8->5->6->1
->3->7->4->8->2->5->6->1
->3->7->4->6->5->8->2->1
->3->7->4->1->2->8->6->5
->3->7->4->1->5->6->8->2
->3->7->6->8->2->5->1->4
->3->7->6->8->5->2->4->1
->3->7->6->8->5->2->1->4
->3->7->6->1->5->2->8->4
->3->7->1->4->2->8->6->5
->3->7->1->4->2->6->8->5
->3->7->1->4->8->2->6->5
->3->7->1->6->5->2->8->4
->3->7->1->5->8->2->6->4
->3->7->1->5->6->2->8->4
->3->7->5->2->8->6->1->4
->3->7->5->8->2->4->6->1
->3->7->5->8->2->6->4->1
->3->7->5->8->6->2->4->1
->3->5->2->6->8->7->1->4
->3->5->8->6->2->4->1->7
->3->5->6->2->8->4->1->7
->3->5->6->8->2->4->1->7
->3->5->6->8->2->1->4->7
->3->5->6->8->7->4->1->2
->3->5->7->1->4->2->6->8
->4->2->8->6->5->3->7->1
->4->2->8->5->6->1->3->7
->4->2->8->5->7->3->1->6
->4->2->6->8->3->5->7->1
->4->2->6->8->5->3->7->1
->4->2->6->8->5->7->3->1
->4->2->6->5->8->3->1->7
->4->2->5->8->6->7->3->1
->4->8->2->6->5->1->7->3
->4->8->2->6->5->3->7->1
->4->8->2->5->6->1->3->7
->4->8->2->5->6->1->7->3
->4->8->2->5->1->6->7->3
->4->8->3->2->6->5->1->7
->4->8->5->2->6->7->1->3
->4->8->5->6->2->3->1->7
->4->6->2->8->5->1->7->3
->4->6->2->8->5->7->1->3
->4->6->2->8->5->7->3->1
->4->6->2->5->8->7->1->3
->4->6->1->3->7->5->8->2
->4->6->7->8->5->2->1->3
->4->6->5->8->2->1->3->7
->4->1->2->8->6->5->3->7
->4->1->2->3->5->6->8->7
->4->1->2->5->8->6->7->3
->4->1->6->8->2->5->7->3
->4->1->3->2->6->8->5->7
->4->1->3->2->6->5->8->7
->4->1->3->2->5->6->8->7
->4->1->3->7->6->8->5->2
->4->1->3->7->5->8->2->6
->4->1->3->7->5->8->6->2
->4->1->7->8->6->2->5->3
->4->1->7->3->5->8->6->2
->4->1->7->3->5->6->2->8
->4->1->7->3->5->6->8->2
->4->1->7->5->2->6->8->3
->4->1->7->5->3->8->6->2
->4->1->5->2->8->6->7->3
->4->1->5->6->8->2->3->7
->4->3->8->2->6->5->1->7
->4->3->8->6->2->5->1->7
->4->3->8->6->2->5->7->1
->4->3->8->6->5->2->1->7
->4->3->1->2->5->8->6->7
->4->3->1->2->5->8->7->6
->4->3->1->2->5->6->8->7
->4->3->1->6->5->2->8->7
->4->3->1->7->8->5->2->6
->4->3->1->7->6->2->5->8
->4->3->1->7->5->8->2->6
->4->3->7->6->8->2->5->1
->4->3->7->6->8->5->2->1
->4->3->7->6->1->5->2->8
->4->3->7->1->6->5->2->8
->4->3->7->1->5->8->2->6
->4->3->7->1->5->6->2->8
->4->3->7->5->2->8->6->1
->4->3->5->2->6->8->7->1
->4->7->8->2->5->6->1->3
->4->7->8->6->5->2->1->3
->4->7->8->6->5->2->3->1
->4->7->8->6->5->3->2->1
->4->7->8->5->6->2->3->1
->4->7->6->8->5->2->1->3
->4->7->1->2->5->6->8->3
->4->7->1->3->2->6->5->8
->4->7->1->3->8->5->6->2
->4->7->1->5->2->6->8->3
->4->7->1->5->6->2->8->3
->4->7->1->5->6->2->3->8
->4->7->3->2->8->6->5->1
->4->7->3->1->2->8->5->6
->4->7->3->1->6->5->2->8
->4->7->3->1->6->5->8->2
->4->7->3->5->6->8->2->1
->4->7->5->8->6->2->3->1
->5->2->4->1->3->7->6->8
->5->2->8->4->3->7->6->1
->5->2->8->4->3->7->1->6
->5->2->8->4->7->3->1->6
->5->2->8->6->1->4->3->7
->5->2->8->6->7->3->4->1
->5->2->8->7->4->3->1->6
->5->2->6->4->3->1->7->8
->5->2->6->8->3->4->1->7
->5->2->6->8->3->4->7->1
->5->2->6->8->7->1->4->3
->5->2->6->7->1->3->4->8
->5->2->1->4->3->7->6->8
->5->2->1->3->4->6->7->8
->5->2->1->3->4->7->8->6
->5->2->1->3->4->7->6->8
->5->2->1->7->4->3->8->6
->5->2->3->1->4->7->8->6
->5->8->2->4->6->1->3->7
->5->8->2->4->7->3->1->6
->5->8->2->6->4->1->3->7
->5->8->2->6->4->3->1->7
->5->8->2->6->4->3->7->1
->5->8->2->1->3->7->4->6
->5->8->4->3->1->7->6->2
->5->8->4->7->1->3->2->6
->5->8->6->2->4->1->3->7
->5->8->6->2->4->1->7->3
->5->8->6->2->3->1->4->7
->5->8->6->7->4->3->1->2
->5->8->6->7->3->4->1->2
->5->8->6->7->3->1->4->2
->5->8->3->1->7->4->2->6
->5->8->7->4->1->3->2->6
->5->8->7->6->4->3->1->2
->5->8->7->1->3->4->6->2
->5->6->2->4->7->1->3->8
->5->6->2->8->4->1->7->3
->5->6->2->8->4->3->7->1
->5->6->2->8->3->4->7->1
->5->6->2->3->8->4->7->1
->5->6->2->3->1->4->7->8
->5->6->2->3->1->7->4->8
->5->6->4->7->3->1->2->8
->5->6->8->2->4->1->7->3
->5->6->8->2->1->4->7->3
->5->6->8->2->3->7->4->1
->5->6->8->3->4->7->1->2
->5->6->8->7->4->1->2->3
->5->6->8->7->4->1->3->2
->5->6->8->7->4->3->1->2
->5->6->1->3->4->7->8->2
->5->6->1->3->7->4->2->8
->5->6->1->3->7->4->8->2
->5->6->1->7->3->4->8->2
->5->1->4->3->7->6->8->2
->5->1->4->7->3->2->8->6
->5->1->6->7->3->4->8->2
->5->1->7->4->8->3->2->6
->5->1->7->4->3->8->2->6
->5->1->7->4->3->8->6->2
->5->1->7->3->4->8->2->6
->5->1->7->3->4->6->2->8
->5->3->2->1->4->7->8->6
->5->3->4->1->7->8->6->2
->5->3->8->6->2->4->1->7
->5->3->7->4->1->2->8->6
->5->3->7->1->4->2->8->6
->5->3->7->1->4->2->6->8
->5->3->7->1->4->8->2->6
->5->7->4->1->3->2->6->8
->5->7->1->4->2->6->8->3
->5->7->1->4->3->8->6->2
->5->7->1->3->4->6->2->8
->5->7->3->4->1->6->8->2
->5->7->3->1->4->2->6->8
->5->7->3->1->4->6->2->8
->5->7->3->1->6->4->2->8
->6->2->4->1->3->7->5->8
->6->2->4->1->7->3->5->8
->6->2->4->1->7->5->3->8
->6->2->4->7->1->3->8->5
->6->2->8->4->1->7->3->5
->6->2->8->4->3->7->1->5
->6->2->8->3->4->7->1->5
->6->2->8->5->1->7->3->4
->6->2->8->5->7->1->3->4
->6->2->8->5->7->3->1->4
->6->2->3->8->4->7->1->5
->6->2->3->1->4->7->8->5
->6->2->3->1->4->7->5->8
->6->2->3->1->7->4->8->5
->6->2->5->8->4->3->1->7
->6->2->5->8->7->1->3->4
->6->2->5->1->7->4->3->8
->6->2->5->3->4->1->7->8
->6->2->5->7->1->4->3->8
->6->4->2->8->5->7->3->1
->6->4->1->3->7->5->8->2
->6->4->3->1->2->5->8->7
->6->4->3->1->7->8->5->2
->6->4->3->1->7->5->8->2
->6->4->3->7->1->5->8->2
->6->4->7->3->1->2->8->5
->6->8->2->4->1->7->3->5
->6->8->2->1->4->7->3->5
->6->8->2->3->7->4->1->5
->6->8->2->5->1->4->3->7
->6->8->2->5->7->3->4->1
->6->8->3->4->1->7->5->2
->6->8->3->4->7->1->2->5
->6->8->3->4->7->1->5->2
->6->8->3->5->7->1->4->2
->6->8->7->4->1->2->3->5
->6->8->7->4->1->3->2->5
->6->8->7->4->3->1->2->5
->6->8->7->1->4->3->5->2
->6->8->5->2->4->1->3->7
->6->8->5->2->1->4->3->7
->6->8->5->2->1->3->4->7
->6->8->5->3->7->1->4->2
->6->8->5->7->4->1->3->2
->6->8->5->7->3->1->4->2
->6->1->4->3->7->5->2->8
->6->1->3->4->7->8->2->5
->6->1->3->7->4->2->8->5
->6->1->3->7->4->8->2->5
->6->1->3->7->5->8->2->4
->6->1->7->3->4->8->2->5
->6->1->5->2->8->4->3->7
->6->7->4->3->1->2->5->8
->6->7->8->5->2->1->3->4
->6->7->1->3->4->8->5->2
->6->7->3->4->8->2->5->1
->6->7->3->4->1->2->5->8
->6->7->3->4->1->5->2->8
->6->7->3->1->4->2->5->8
->6->5->2->8->4->3->7->1
->6->5->2->8->4->7->3->1
->6->5->2->8->7->4->3->1
->6->5->2->1->3->4->7->8
->6->5->2->1->7->4->3->8
->6->5->2->3->1->4->7->8
->6->5->8->2->4->7->3->1
->6->5->8->2->1->3->7->4
->6->5->8->4->7->1->3->2
->6->5->8->3->1->7->4->2
->6->5->8->7->4->1->3->2
->6->5->1->4->7->3->2->8
->6->5->1->7->4->8->3->2
->6->5->1->7->4->3->8->2
->6->5->1->7->3->4->8->2
->6->5->3->2->1->4->7->8
->6->5->3->7->4->1->2->8
->6->5->3->7->1->4->2->8
->6->5->3->7->1->4->8->2
->7->4->2->8->5->6->1->3
->7->4->2->6->5->8->3->1
->7->4->8->2->5->6->1->3
->7->4->8->3->2->6->5->1
->7->4->8->5->6->2->3->1
->7->4->6->5->8->2->1->3
->7->4->1->2->8->6->5->3
->7->4->1->2->3->5->6->8
->7->4->1->3->2->6->8->5
->7->4->1->3->2->6->5->8
->7->4->1->3->2->5->6->8
->7->4->1->5->6->8->2->3
->7->4->3->8->2->6->5->1
->7->4->3->8->6->2->5->1
->7->4->3->8->6->5->2->1
->7->4->3->1->2->5->8->6
->7->4->3->1->2->5->6->8
->7->4->3->1->6->5->2->8
->7->8->2->5->6->1->3->4
->7->8->6->2->5->3->4->1
->7->8->6->5->2->1->3->4
->7->8->6->5->2->3->1->4
->7->8->6->5->3->2->1->4
->7->8->5->2->6->4->3->1
->7->8->5->2->1->3->4->6
->7->8->5->6->2->3->1->4
->7->6->2->5->8->4->3->1
->7->6->4->3->1->2->5->8
->7->6->8->2->5->1->4->3
->7->6->8->5->2->4->1->3
->7->6->8->5->2->1->4->3
->7->6->8->5->2->1->3->4
->7->6->1->5->2->8->4->3
->7->1->2->5->6->8->3->4
->7->1->4->2->8->6->5->3
->7->1->4->2->6->8->3->5
->7->1->4->2->6->8->5->3
->7->1->4->8->2->6->5->3
->7->1->4->3->8->6->2->5
->7->1->4->3->5->2->6->8
->7->1->6->5->2->8->4->3
->7->1->3->2->6->5->8->4
->7->1->3->4->8->5->2->6
->7->1->3->4->6->2->8->5
->7->1->3->4->6->2->5->8
->7->1->3->8->5->6->2->4
->7->1->5->2->6->8->3->4
->7->1->5->8->2->6->4->3
->7->1->5->6->2->8->4->3
->7->1->5->6->2->8->3->4
->7->1->5->6->2->3->8->4
->7->3->2->8->6->5->1->4
->7->3->4->8->2->6->5->1
->7->3->4->8->2->5->6->1
->7->3->4->8->2->5->1->6
->7->3->4->6->2->8->5->1
->7->3->4->1->2->5->8->6
->7->3->4->1->6->8->2->5
->7->3->4->1->5->2->8->6
->7->3->1->2->8->5->6->4
->7->3->1->4->2->6->8->5
->7->3->1->4->2->5->8->6
->7->3->1->4->6->2->8->5
->7->3->1->6->4->2->8->5
->7->3->1->6->5->2->8->4
->7->3->1->6->5->8->2->4
->7->3->5->8->6->2->4->1
->7->3->5->6->2->8->4->1
->7->3->5->6->8->2->4->1
->7->3->5->6->8->2->1->4
->7->5->2->8->6->1->4->3
->7->5->2->6->8->3->4->1
->7->5->8->2->4->6->1->3
->7->5->8->2->6->4->1->3
->7->5->8->2->6->4->3->1
->7->5->8->6->2->4->1->3
->7->5->8->6->2->3->1->4
->7->5->3->8->6->2->4->1
->8->2->4->6->1->3->7->5
->8->2->4->1->7->3->5->6
->8->2->4->7->3->1->6->5
->8->2->6->4->1->3->7->5
->8->2->6->4->3->1->7->5
->8->2->6->4->3->7->1->5
->8->2->6->5->1->7->4->3
->8->2->6->5->1->7->3->4
->8->2->6->5->3->7->1->4
->8->2->1->4->7->3->5->6
->8->2->1->3->7->4->6->5
->8->2->3->7->4->1->5->6
->8->2->5->6->1->3->4->7
->8->2->5->6->1->3->7->4
->8->2->5->6->1->7->3->4
->8->2->5->1->4->3->7->6
->8->2->5->1->6->7->3->4
->8->2->5->7->3->4->1->6
->8->4->1->7->3->5->6->2
->8->4->3->1->7->6->2->5
->8->4->3->7->6->1->5->2
->8->4->3->7->1->6->5->2
->8->4->3->7->1->5->6->2
->8->4->7->1->3->2->6->5
->8->4->7->1->5->6->2->3
->8->4->7->3->1->6->5->2
->8->6->2->4->1->3->7->5
->8->6->2->4->1->7->3->5
->8->6->2->4->1->7->5->3
->8->6->2->3->1->4->7->5
->8->6->2->5->1->7->4->3
->8->6->2->5->3->4->1->7
->8->6->2->5->7->1->4->3
->8->6->1->4->3->7->5->2
->8->6->7->4->3->1->2->5
->8->6->7->3->4->1->2->5
->8->6->7->3->4->1->5->2
->8->6->7->3->1->4->2->5
->8->6->5->2->1->3->4->7
->8->6->5->2->1->7->4->3
->8->6->5->2->3->1->4->7
->8->6->5->1->4->7->3->2
->8->6->5->3->2->1->4->7
->8->6->5->3->7->4->1->2
->8->6->5->3->7->1->4->2
->8->3->2->6->5->1->7->4
->8->3->4->1->7->5->2->6
->8->3->4->7->1->2->5->6
->8->3->4->7->1->5->2->6
->8->3->4->7->1->5->6->2
->8->3->1->7->4->2->6->5
->8->3->5->7->1->4->2->6
->8->7->4->1->2->3->5->6
->8->7->4->1->3->2->6->5
->8->7->4->1->3->2->5->6
->8->7->4->3->1->2->5->6
->8->7->4->3->1->6->5->2
->8->7->6->4->3->1->2->5
->8->7->1->4->3->5->2->6
->8->7->1->3->4->6->2->5
->8->5->2->4->1->3->7->6
->8->5->2->6->4->3->1->7
->8->5->2->6->7->1->3->4
->8->5->2->1->4->3->7->6
->8->5->2->1->3->4->6->7
->8->5->2->1->3->4->7->6
->8->5->6->2->4->7->1->3
->8->5->6->2->3->1->4->7
->8->5->6->2->3->1->7->4
->8->5->6->4->7->3->1->2
->8->5->6->1->3->7->4->2
->8->5->1->7->3->4->6->2
->8->5->3->7->1->4->2->6
->8->5->7->4->1->3->2->6
->8->5->7->1->3->4->6->2
->8->5->7->3->1->4->2->6
->8->5->7->3->1->4->6->2
->8->5->7->3->1->6->4->2
Source (brute force java):
http://pastebin.com/m21e7a247


When you want something, all the universe conspires in helping you to achieve it.
cichli
Profile Joined August 2006
Sweden84 Posts
July 03 2009 00:31 GMT
#24
On July 03 2009 09:18 Cambium wrote:
Did you try working out your solution by hand?

I tried one:
- [1, 2, 5, 3, 8, 7, 4, 6] and it doesn't work

It fails on 8...


No, it does not fail. This is a solution for a different version of the problem originally posed: what you're looking at is a solution for placing the numbers 1-8 in 8 boxes, rather than the numbers 1-9 in 9 boxes. Thus, 8 is the last number in the sequence and should reach itself. 8 is also reachable from 7.
The Internet will not listen to reason
Cambium
Profile Blog Joined June 2004
United States16368 Posts
July 03 2009 00:37 GMT
#25
On July 03 2009 09:31 cichli wrote:
Show nested quote +
On July 03 2009 09:18 Cambium wrote:
Did you try working out your solution by hand?

I tried one:
- [1, 2, 5, 3, 8, 7, 4, 6] and it doesn't work

It fails on 8...


No, it does not fail. This is a solution for a different version of the problem originally posed: what you're looking at is a solution for placing the numbers 1-8 in 8 boxes, rather than the numbers 1-9 in 9 boxes. Thus, 8 is the last number in the sequence and should reach itself. 8 is also reachable from 7.


Ohhh, your answer details position and number. I thought it was the sequence of numbers to be inserted. My apologies.
When you want something, all the universe conspires in helping you to achieve it.
coltrane
Profile Blog Joined June 2008
Chile988 Posts
July 03 2009 00:47 GMT
#26
ahah, didnt read dromar second spoiler before, he is right...

46 is the totall sum, if we asume 9 is our last number we have a partial sum of 37, that is 1+36, so is the class of 1, is already taken by our first number.
Jävla skit
cichli
Profile Joined August 2006
Sweden84 Posts
July 03 2009 00:52 GMT
#27
Wrote an improved SML solution that uses backtracking instead of testing all permutations. The code is still pretty ugly and completely undocumented, but performance increased somewhat and I could test it with slighly larger problem sizes. We now have the following results:

(number of boxes to fill, number of possible solutions)
________________________________
(0,0)
(1,1)
(2,1)
(3,0)
(4,2)
(5,0)
(6,4)
(7,0)
(8,24)
(9,0)
(10,288)
(11,0)
(12,3856)
(13,0)
(14,89328)

The trend continues: for sequences with length >1, only sequences of even length yield any solutions at all. It sounds like a reasonable hypothesis, but does it hold in general? How many of our first-born must we sacrifice to the number theory gods in order to prove it?

Also, for even-length sequences, the number of possible solutions seems to increase exponentially. This is hardly surprising.

When I feel like it, I'll try to state this as a constraint satisfaction problem in GeCode/J and see if I get better performance that way.

On July 03 2009 09:37 Cambium wrote:
Ohhh, your answer details position and number. I thought it was the sequence of numbers to be inserted. My apologies.


No problem: I should have bothered to explain my notation better
The Internet will not listen to reason
coltrane
Profile Blog Joined June 2008
Chile988 Posts
July 03 2009 00:58 GMT
#28
u dont need number theory... u probe it with group theory in 2 steps, im sure, but i am looking at my old university books to write it well.
Jävla skit
moriya
Profile Joined March 2009
United States54 Posts
Last Edited: 2009-07-03 01:49:46
July 03 2009 01:47 GMT
#29
it is no surprise that only even numbers have solution. The sum of 1 to n-1 can be divided by n if n is odd, which means that the last number n have to be put on the same position of 1.
If n is even, the solution is actually a sequence Ai where A1,A2,...A(n-1) is picked from 1 to n-1 and satisfy that A1,A1+A2,...A1+....A(n-1)|| mod n are all different (1 to n-1).
ReMiiX
Profile Blog Joined April 2009
United States338 Posts
July 03 2009 04:38 GMT
#30
I am working on coding the solution now, it should take quite a while to write then run so I will post my results later today.
GaTech CSL fighting!
Joseph A. T.
Profile Joined July 2009
Lebanon6 Posts
July 03 2009 06:50 GMT
#31
Thanks a lot, because you are interested in the problem micronesia have posted for me ...
I'm sorry because the first problem (with numbers from 1 to 9) was impossible to solve, but i understand why it won't work with odd numbers, I think moriya is completely true.
And, if someone knows C++, could he send me the source code of the program to solve this problem , plz ...

(Sorry for my poor english)
cichli
Profile Joined August 2006
Sweden84 Posts
Last Edited: 2009-07-03 09:14:49
July 03 2009 09:06 GMT
#32
On July 03 2009 10:47 moriya wrote:
it is no surprise that only even numbers have solution. The sum of 1 to n-1 can be divided by n if n is odd, which means that the last number n have to be put on the same position of 1.
If n is even, the solution is actually a sequence Ai where A1,A2,...A(n-1) is picked from 1 to n-1 and satisfy that A1,A1+A2,...A1+....A(n-1)|| mod n are all different (1 to n-1).


Good observations! It's easy to prove that odd numbers >1 don't have solutions: the sum of the numbers 1 to n-1 is the n-1:th trianglular number. can be written on the form T(n) = n*(n-1)/2. If n is odd and n>1, n is a divisor of T(n): (n-1)=2*m for some integer m and thus T(n) = n*2*m/2 = n*m which is divisible by n. This means that n will land on the same spot as 1 no matter which order we place the others in.

So far so good: we have proven that odd numbers >1 don't have solutions. But can we prove that all even-length sequences have solutions?
The Internet will not listen to reason
igotmyown
Profile Blog Joined April 2009
United States4291 Posts
July 03 2009 12:21 GMT
#33
Let p be prime. There exists a generator (I forget the language) a, such that, |{a^i mod p: i in {1..p-1} }| = p-1; that is each a^i is unique mod p. a^(i+1)-a^i=(a-1)*a^i, and since a-1 is relatively prime to p, and a^i generates 1..p-1, we have a solution. That is, start at 1, fill in a-1. Move a-1 mod p, you're at box a mod p. Fill in (a-1)*a^i, you will end up in box a^i. There will be no repeats, since a is a generator.

I'm ignoring the pth (or 0 mod p term). You should be able to fill in the boxes relatively prime to n. As for the rest of the boxes, hopefully people can figure out something clever.
Normal
Please log in or register to reply.
Live Events Refresh
WardiTV Summer Champion…
11:00
Open Qualifier #3
WardiTV628
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Harstem 318
StarCraft: Brood War
Britney 48719
Bisu 2568
Shuttle 2160
ggaemo 555
Mini 495
Zeus 473
Hyuk 302
Last 265
Soulkey 239
sSak 218
[ Show more ]
Soma 189
ZerO 176
Snow 167
Leta 148
ToSsGirL 106
Pusan 90
soO 78
sorry 74
Nal_rA 66
Sharp 58
[sc1f]eonzerg 39
Aegong 31
Sacsri 24
Noble 22
ajuk12(nOOB) 21
Backho 16
scan(afreeca) 15
SilentControl 8
JulyZerg 8
IntoTheRainbow 6
ivOry 6
Terrorterran 1
Stormgate
TKL 188
Dota 2
XcaliburYe243
KheZu173
Counter-Strike
x6flipin649
byalli262
zeus207
flusha163
kRYSTAL_55
edward50
Other Games
singsing1622
B2W.Neo1196
hiko577
crisheroes380
RotterdaM230
Hui .215
Fuzer 195
KnowMe123
Happy120
ArmadaUGS47
rGuardiaN43
QueenE41
ZerO(Twitch)11
Organizations
StarCraft: Brood War
UltimateBattle 29
lovetv 10
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• StrangeGG 71
• davetesta14
• Dystopia_ 3
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV554
League of Legends
• Nemesis2595
Upcoming Events
Stormgate Nexus
58m
TKL 188
uThermal 2v2 Circuit
2h 58m
DaveTesta Events
10h 58m
The PondCast
20h 58m
WardiTV Summer Champion…
21h 58m
Replay Cast
1d 10h
LiuLi Cup
1d 21h
uThermal 2v2 Circuit
2 days
RSL Revival
2 days
RSL Revival
2 days
[ Show More ]
uThermal 2v2 Circuit
3 days
CSO Cup
3 days
Sparkling Tuna Cup
3 days
uThermal 2v2 Circuit
4 days
Wardi Open
4 days
RotterdaM Event
5 days
RSL Revival
6 days
Liquipedia Results

Completed

ASL Season 20: Qualifier #2
FEL Cracow 2025
CC Div. A S7

Ongoing

Copa Latinoamericana 4
Jiahua Invitational
BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Qualifiers
HCC Europe
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025

Upcoming

ASL Season 20
CSLPRO Chat StarLAN 3
BSL Season 21
BSL 21 Team A
RSL Revival: Season 2
Maestros of the Game
SEL Season 2 Championship
WardiTV Summer 2025
uThermal 2v2 Main Event
MESA Nomadic Masters Fall
Thunderpick World Champ.
CS Asia Championships 2025
Roobet Cup 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.