Skip to content

This function lists the permutations in which from the first arrangement, no student fights the same pair of students twice

License

Notifications You must be signed in to change notification settings

NiloGregginz33/My-Hello-World-first-code-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Seperating kids from fighting

Now this wasn't a problem in itself, except for the fact that I had 2 kids in the same class that used to fight like every day. Each kid would enter the class in a neutral state. After the first circuit I have them swim, the order gets changed so that no kid sits by the same pair of kids again when I have them line against a wall as opposed to swimming a circuit around me. The kids who only have 1 neighbor treat that arrangement as ok if that one neighbor has appeared in a neighbor pair of students but not if they individually sat next to that persons on the edges before.
The question I had was simple. How many laps would a group of N students be able to swim before at least one student was no longer able to find neighbors that they had not been seated around before? What was the permutation set of the students that satisfied this condition first from the original arrangement? How does 16 yr old me find out what question to ask my teachers and later my college professors? Why did I spend 3 years thinking about this only to wait a year before I post my solution?

The way I imagined the students was at first a set of legos that all had different colors and then later as unique prime numbers. Before I learned any programming, how did I test my hypotheses for laps with N students against idealized objects? The answer is surprisingly LAME!!! I did it all on paper and pretended they were actually colored blocks and tried to find patterns which would always produce a new lap in the finite block set (see images). I tried everything from breaking things up into groups of 3 and trying to find all the symmetrical combinations of patterns like moving every other block in a circular way but keeping the ones not moved in the same position. I then just went with trying to multiply the amount of these checkered squares with the number of ways I could find to move the blocks so that they skipped one or two blocks but symmetrically across the line. This was a first guess, and I was wrong. Then I tried something I had learned a year earlier to try to apply math to Yugioh (dont ask) -- n choose k. Maybe since I knew that there couldn't possibly be more than (N)(N-1)/2 solutions since there were essentially 2 choices you had (either on the edge or not) and because I knew that since both kids on the ends would essentially share 1 neighbor (the water) I thought there would be a general equation for N. After asking my teachers for a bit and trying reallyyyyy hard to find a general equation, I instead found a solution. Not because I surprisingly couldn't match the sequence of numbers I found in the OEIS (Online Encyclopedia of Integer Sequences), but because I learned to communicate to others who share my love for math. I never did find a general equation for the problem but I dedicate my first github source code to this random string generator problem that I created a notebook graveyard for over the years :)

number sequence is looking for a general equation to this problem 1,1,3,4,8,15,22..

About

This function lists the permutations in which from the first arrangement, no student fights the same pair of students twice

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages