Advertisement
Guest User

What's my number

a guest
Feb 6th, 2016
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.31 KB | None | 0 0
  1. require 'Prime'
  2. (1..1000).each{|v| p v if v.to_s.length >= 2 && Prime.prime?(v) && v.to_s.count("1") == v.to_s.count("7") && v.to_s.count("1") == 0 && v.to_s.chars.map{|i| i.to_i}.reduce(:+) <= 10 && v.to_s[0..1].chars.map{|i| i.to_i}.reduce(:+) % 2 == 1 && v.to_s[-2].to_i % 2 == 0 && v.to_s[-1].to_i == v.to_s.length}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement