As maykey said, in ruby ββthere is no post-increment ( ++ ) operator. However, there is one unary plus (written +@ when it is defined)
last_known_prime++ found_factor = false
parsed as something like
last_known_prime + (+(found_factor = false)) --------------------^ unary plus on false
which causes your cryptic error.
source share