Skip to content

Instantly share code, notes, and snippets.

@lbvf50mobile
Last active November 24, 2017 13:16
Show Gist options
  • Select an option

  • Save lbvf50mobile/b508165ea7b226ebb530f7404e53b1f5 to your computer and use it in GitHub Desktop.

Select an option

Save lbvf50mobile/b508165ea7b226ebb530f7404e53b1f5 to your computer and use it in GitHub Desktop.
prime simple
# https://www.codewars.com/kata/stone-bridge-primes/train/ruby
require "prime"
def solve(x,y)
a = []
for m in 0..10
for n in 0..10
a << calc(m,n)
end
end
ans = a.select{|e| Prime.prime?(e)}.sort.select{|e| e >= x and e < y }.size
end
def calc(m,n)
p_ = 2**m * 3**n + 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment