Euler Project problems solved with functional PHP