check_factordb.sf 348 B

12345678910111213141516171819
  1. #!/usr/bin/ruby
  2. # Given a list of numbers, check which ones are fully factorized in factordb.com
  3. ARGF.each {|n|
  4. n.to_i!
  5. n > 1 || next
  6. say "Checking: C#{n.len}"
  7. var factors = `#{$^PERL} ../../../factordb/get_factordb.pl #{n}`.nums
  8. assert_eq(factors.prod, n)
  9. if (factors.all{.is_prime}) {
  10. say "FF: #{n}"
  11. }
  12. }