Skip to content

Instantly share code, notes, and snippets.

@cielavenir
Created August 26, 2012 20:30
Show Gist options
  • Select an option

  • Save cielavenir/3483402 to your computer and use it in GitHub Desktop.

Select an option

Save cielavenir/3483402 to your computer and use it in GitHub Desktop.
Project Euler 35
#!/usr/bin/ruby
require 'prime';
h={};a=[]
Prime.each(999999){|e|h[e]=1;a.push(e)}
p a.count{|x|s=x.to_s;s.length.times.map{|i|h[(s[i,s.length-i]+s[0,i]).to_i]}.all?}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment