Your challenge is to write a program or function to output this sequence of numbers.
- Must contain numbers specified above
- Must be in order as specified
- Numbers must be delimited by whitespace
Shortest code in bytes wins.
Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It only takes a minute to sign up.Sign up to join this community
Ａ σ Assign to s ⁻Ｘ²¦³²¦⁵ 2 ** 32 - 5 Ａ¹φ Assign 1 to f (factorial) Ａ¹κ Assign 1 to k Ｆ⁶⁴⁹⁹« For i from 0 to 6498 ⁺﹪⁻σφσ¶ (s - f) % s + "\n" (implicitly printed) Ａ⁺κ¹κ k = k + 1 Ａ×φκφ Assign f * k to f
Only checked first and last numbers. If you run it TIO will probably take a while to print them all
žJ5- # (2 ** 32) - 5; call this x 6499F # for N in 0 .. 6498. Stack entering loop: [x] D # duplicate. Stack: [x, x] N> # N + 1. Stack: [x, x, N + 1] ! # factorial. Stack: [x, x, (N + 1)!] - # subtract. Stack: [x, x - (N + 1)!] s # swap. Stack: [x - (N + 1)!, x] D # duplicate. Stack: [x - (N + 1)!, x, x] Š # cycle last three items. Stack: [x, x - (N + 1)!, x] % # modulus. Stack [x, (x - (N + 1)!) % x)] , # pop and print. Stack: [x]