PollardRho example implementation in Scala