2 added 513 characters in body edited Sep 21 '17 at 6:37 b3m2a1 31.7k33 gold badges6363 silver badges184184 bronze badges Do note, though, that this findM is mad slow, even with memoization. But I think you want a formula, not a procedure, anyway.findM /@ Range[50] // AbsoluteTiming {183.835, {5, 13, 19, 32, 53, 89, 89, 139, 139, 199, 199, 293, 293, 887, 887, 887, 887, 887, 887, 1129, 1129, 1331, 1331, 1331, 1331, 1331, 1331, 1331, 1331, 5591, 5591, 8467, 8467, 9551, 9551, 15683, 15683, 15683, 15683, 15683, 15683, 15683, 15683, 19609, 19609, 19609, 19609, 19609, 19609, 19609}}  Do note, though, that this findM is mad slow, even with memoization. But I think you want a formula, not a procedure, anyway.findM /@ Range[50] // AbsoluteTiming {183.835, {5, 13, 19, 32, 53, 89, 89, 139, 139, 199, 199, 293, 293, 887, 887, 887, 887, 887, 887, 1129, 1129, 1331, 1331, 1331, 1331, 1331, 1331, 1331, 1331, 5591, 5591, 8467, 8467, 9551, 9551, 15683, 15683, 15683, 15683, 15683, 15683, 15683, 15683, 19609, 19609, 19609, 19609, 19609, 19609, 19609}}  1 answered Sep 21 '17 at 6:32 b3m2a1 31.7k33 gold badges6363 silver badges184184 bronze badges So if I understand the question correctly you want to find the minimal M such that given k, this holds: Equal@@Table[LCM@@Range[M+p], {p, 0, k-1}]  Or rather you want to find a way to know how far off your M is. I can't provide you with a close-form solution for this. But I can show how drastically off that formula is. Here's a memoized recursive, unoptimized, clumsy, procedural search for M (but it took like 2 seconds to write, so there you are): Clear[findM]; findM[1] = 5; findM[k_] := findM[k] = Block[{ mTest = findM[k - 1], oldVal, newVal, hits = 1 }, oldVal = LCM @@ Range[mTest]; While[hits < k + 1, If[oldVal === (newVal = LCM @@ Range[++mTest]), hits++, oldVal = newVal; hits = 1 ] ]; mTest - k ]  And here's that testing function: mTest[m_, k_] := Equal @@ Table[LCM @@ Range[m + p], {p, 0, k - 1}]  And finally here's the formula for M you had: weirdM[k_] := 1 + Product[ Power[p, 1 + Floor[Log[p, k + 1]]], {p, 2, k + 1} ]  Now let's compute differences between the found value and the weirdM value: weirdM[#] - findM[#] & /@ Range[15] {0, 24, 1134, 28769, 1036748, 50803112, 6502809512, 1580182732662, \ 158018273279862, 19120211066879802, 2753310393630719802, \ 465309456523591679708, 91200653478623969279708, \ 20520147032690393087999114, 42025261122949925044223999114}  You can see weirdM blows up way faster than findM. And here's what the values should be, if I'm reading the question right: findM /@ Range[15] {5, 13, 19, 32, 53, 89, 89, 139, 139, 199, 199, 293, 293, 887, 887}  And just to check: mTest[findM[#], #] & /@ Range[15] {True, True, True, True, True, True, True, True, True, True, True, \ True, True, True, True}  So, in short, the formula fails to find the minimal such M by k=2 I think. And it fails ever more dramatically as k increases.