use isprime primitive to create amore flexible lcm word