Skip to content

Instantly share code, notes, and snippets.

@abelorian
Created October 24, 2017 04:07
Show Gist options
  • Save abelorian/50ab94f56a0770ff6743531c0285d2bc to your computer and use it in GitHub Desktop.
Save abelorian/50ab94f56a0770ff6743531c0285d2bc to your computer and use it in GitHub Desktop.
Primos terminados en 7
require "prime"
primes = []
i = 7
loop do
primes << i if Prime.prime?(i)
break if primes.length >= 60
i += 10
end
p primes
# Result
# [7, 17, 37, 47, 67, 97, 107, 127, 137, 157, 167, 197, 227, 257, 277, 307, 317, 337, 347, 367, 397, 457,
# 467, 487, 547, 557, 577, 587, 607, 617, 647, 677, 727, 757, 787, 797, 827, 857, 877, 887, 907, 937, 947,
# 967, 977, 997, 1087, 1097, 1117, 1187, 1217, 1237, 1277, 1297, 1307, 1327, 1367, 1427, 1447, 1487]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment