#!/usr/bin/env ruby
def is_prime(n)
("1" \* n.to_i)!~ /^1?$|^(11+?)\1+$/
endnum = ARGV.shift
$stdout.puts is_prime(num)
... then decided to test it on a button-mashed number:
$ruby ~/prime.rb 767423
... and it hung.
Thought it was the length of the number, so I tried something smaller (101). Quick "true". Then I tried progressively more digits. I got to `ruby ~/prime.rb 7673121` (false) and it took less than a second.
But it doesn't like something about the number 767423.