Created
December 13, 2020 12:58
-
-
Save neoneye/8e00bbf83898a03da911ba9a7bd76b7e to your computer and use it in GitHub Desktop.
OEIS A339699
This file contains hidden or 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
require 'prime' | |
def plot(values, modvalue) | |
puts | |
puts "plot(values, #{modvalue})" | |
s = values.map {|v| (v % modvalue).to_s(modvalue) }.join('') | |
modvalue.times do |i| | |
value = i.to_s(modvalue) | |
re = Regexp.new("[^" + value + "]") | |
puts '# ' + s.gsub(re, ' ') | |
end | |
end | |
values = Prime.first(100).each_with_index.map { |prime, index| (prime**2) * (index+1) } | |
# p values | |
puts "# Except for the initial two entries, there is a repeating pattern with modulus: 2, 3, 4, 6, 8, 12, 24." | |
puts "# Generates random data for other modulus values such as: 5, 7, 9, 10, 11." | |
puts | |
puts "# Repeating patterns" | |
plot(values, 2) | |
plot(values, 3) | |
plot(values, 4) | |
plot(values, 6) | |
plot(values, 8) | |
plot(values, 12) | |
plot(values, 24) | |
puts | |
puts "# Non-repeating patterns" | |
plot(values, 5) | |
plot(values, 7) | |
plot(values, 9) | |
plot(values, 10) | |
plot(values, 11) | |
This file contains hidden or 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
# Except for the initial two entries, there is a repeating pattern with modulus: 2, 3, 4, 6, 8, 12, 24. | |
# Generates random data for other modulus values such as: 5, 7, 9, 10, 11. | |
# Repeating patterns | |
plot(values, 2) | |
# 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
# 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
plot(values, 3) | |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 3 3 3 | |
# 4 4 4 4 4 4 4 4 4 4 | |
# 5 5 5 5 5 5 5 5 | |
# 6 6 6 6 6 6 6 6 6 | |
# 7 7 7 7 7 7 7 7 | |
# 8 8 8 8 8 8 8 8 | |
# 9 9 9 9 9 9 9 9 | |
# a a a a a a a a | |
# b b b b b b b b | |
plot(values, 24) | |
# 0 0 0 0 | |
# 1 1 1 1 | |
# 2 2 2 2 | |
# 3 3 3 3 3 | |
# 4 4 4 4 4 4 | |
# 5 5 5 5 | |
# 6 6 6 6 | |
# 7 7 7 7 | |
# 8 8 8 8 | |
# 9 9 9 9 | |
# a a a a | |
# b b b b | |
# c c c c | |
# d d d d | |
# e e e e | |
# f f f f | |
# g g g g | |
# h h h h | |
# i i i i i | |
# j j j j | |
# k k k k | |
# l l l l | |
# m m m m | |
# n n n n | |
# Non-repeating patterns | |
plot(values, 5) | |
# 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
# 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
# 2 22 2 22 2 2 22 2 2 2 22 22 22 2 22 22 2 | |
# 3 33 33 3 3 3 3 3 3 3 3 3 | |
# 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 | |
plot(values, 7) | |
# 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
# 1 1 1 1 1 1 1 1 1 1 1 | |
# 2 2 22 2 2 2 2 2 2 2 2 2 2 | |
# 3 3 3 33 3 3 3 3 3 3 3 3 3 3 | |
# 44 4 44 4 4 4 4 44 4 4 4 4 4 4 4 | |
# 5 5 5 5 5 5 5 55 5 55 5 5 | |
# 6 66 6 6 6 6 6 6 6 6 6 6 | |
plot(values, 9) | |
# 0 0 0 0 0 0 0 0 0 0 0 0 | |
# 1 1 1 1 1 1 1 1 1 1 1 | |
# 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 | |
# 3 3 3 3 3 3 3 3 3 3 3 | |
# 4 4 4 4 4 4 4 4 4 4 4 | |
# 5 5 5 5 5 5 5 5 | |
# 6 6 6 6 6 6 6 6 6 6 6 | |
# 7 7 7 7 7 7 7 7 7 7 7 7 | |
# 8 8 8 8 8 8 8 8 8 | |
plot(values, 10) | |
# 0 0 0 0 0 0 0 0 0 0 | |
# 1 1 1 1 1 1 1 1 1 1 | |
# 2 2 2 2 2 2 2 2 2 2 2 2 2 | |
# 3 3 3 3 3 3 3 | |
# 4 4 4 4 4 4 4 4 4 4 4 4 4 | |
# 5 5 5 5 5 5 5 5 5 5 5 | |
# 6 6 6 6 6 6 6 6 | |
# 7 7 7 7 7 7 7 7 7 7 7 7 | |
# 8 8 8 8 8 8 8 | |
# 9 9 9 9 9 9 9 9 9 | |
plot(values, 11) | |
# 0 0 0 0 0 0 0 0 0 0 | |
# 1 1 1 1 1 1 1 1 1 11 | |
# 2 2 2 2 2 2 2 22 2 2 | |
# 33 3 3 3 33 3 | |
# 4 4 4 4 4 4 4 4 | |
# 5 5 5 5 5 5 5 5 5 5 | |
# 6 6 6 6 6 6 6 66 6 6 6 6 | |
# 7 7 7 7 7 7 | |
# 8 8 8 8 8 8 8 8 8 | |
# 99 9 9 9 9 9 9 | |
# a a a a a a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment