Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save lbvf50mobile/08e9a80309550ceb174ff221f51d06d3 to your computer and use it in GitHub Desktop.
prime
# https://www.codewars.com/kata/stone-bridge-primes/train/ruby
def solve(x,y)
a = []
for itr in 0..2
p "iteration #{itr}"
i_fora = 2
for i in itr..itr+i_fora
a << calc(i,itr)
end
end
a
end
def calc(i,j)
ans = 2**i * 3**j + 1
p "#{ans} = 2^#{i} * 3^#{j} + 1"
ans
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment