Skip to content

Instantly share code, notes, and snippets.

@dmurawsky
Created May 27, 2020 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmurawsky/8e9ea22cea139a61fe797e756bda7533 to your computer and use it in GitHub Desktop.
Save dmurawsky/8e9ea22cea139a61fe797e756bda7533 to your computer and use it in GitHub Desktop.
The pattern of the universe
// Usage: Run the below code in your termainal by either running node and copying the code into the REPL or by saving the code to a file and running node pattern.js
// It will output a consistent pattern no matter how high you count.
// Change 1000 to a higher number to test it
let number = 1;
while (number < 1000) {
next = number + 1;
let reduce = number * next + "";
while (reduce.length > 1) {
reduce = reduce.split('').reduce((prev, num) => prev + parseInt(num), 0) + "";
}
console.log(reduce);
number = next;
}
@dmurawsky
Copy link
Author

dmurawsky commented May 27, 2020

Example output:

2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 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 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9, 2, 6, 3, 2, 3, 6, 2, 9, 9

Basically a repeating pattern of 2, 6, 3, 2, 3, 6, 2, 9, 9

@dmurawsky
Copy link
Author

This pattern is created by multiplying every number by it's previous number and then adding each digit in the number together. So 1+2=2 and 2*3=6 etc. But once you get to multi-digit numbers, you reduce them to a single digit. So 123 * 124 = 15,252 and 1 + 5 + 2 + 5 + 2 = 15 and 1 + 5 = 6.

@dmurawsky
Copy link
Author

dmurawsky commented Jul 12, 2020

If you add instead of multiply you get a different pattern: 3,5,7,9,2,4,6,8,1

3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,6,8,1,3,5,7,9,2,4,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