I have a PHP script that calculates and counts the number of prime numbers in 1 to 1,000,000 correctly.

I am trying to convert the script into Ruby_2.7.0. on Ubuntu_20.04.``

The full script is at http://davekimble.net/primes.rb

Line 37: if n > sqrt(x) then break end

which the interpreter errors:

```
Traceback (most recent call last):
4: from ./simple/primes/primes.rb:33:in `<main>'
3: from ./simple/primes/primes.rb:33:in `each'
2: from ./simple/primes/primes.rb:35:in `block in <main>'
1: from ./simple/primes/primes.rb:35:in `each'
./simple/primes/primes.rb:37:in `block (2 levels) in <main>': undefined method `>' for nil:NilClass (NoMethodError)
```

I don’t think “>” is a method, and I don’t think “n” is a nil:NilClass, so I can’t fix it.

What is going wrong ?