Skip to content

Instantly share code, notes, and snippets.

@robertjwhitney
Last active December 12, 2015 08:49
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 robertjwhitney/4746899 to your computer and use it in GitHub Desktop.
Save robertjwhitney/4746899 to your computer and use it in GitHub Desktop.
# Generate the sequence of numbers below.
# 0 1 2 3 4 5 6 7 8 9
# 1 2 3 4 5 6 7 8 9 0
# 2 3 4 5 6 7 8 9 0 1
# 3 4 5 6 7 8 9 0 1 2
# 4 5 6 7 8 9 0 1 2 3
# 5 6 7 8 9 0 1 2 3 4
# 6 7 8 9 0 1 2 3 4 5
# 7 8 9 0 1 2 3 4 5 6
# 8 9 0 1 2 3 4 5 6 7
# 9 0 1 2 3 4 5 6 7 8
# 0 1 2 3 4 5 6 7 8 9
# ruby 1.9.3
(0..10).step{|i| puts (0..9).to_a.rotate(i).join}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment