Siege of Eratostenes - JavaScript algorithm (working :P )