Created
July 12, 2020 15:56
-
-
Save tail-call/8fa8747b192c68abaf10f9cdade7f7e6 to your computer and use it in GitHub Desktop.
I wanted a very big sequence of primes but why
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const seq1 = [2, 3]; | |
const seq2 = [2, 3, 5]; | |
const seq3 = [5, 7, 11, 13, 17]; | |
const seq4 = [7, 11, 13, 17, 19, 23, 29]; | |
const length = seq1.length * seq2.length * seq3.length * seq4.length; | |
const p = (seq, i) => seq[i % seq.length]; | |
for (let i = 0; i < length; i++) { | |
console.log(p(seq1, i) * p(seq2, i) * p(seq3, i) * p(seq4, i)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Notice how computed length is wrong because 2 and 3 are shared between first two sequences