project euler 14 in J