Solve hanging lantern problem: Difference between revisions

Content added Content deleted
m (→‎{{header|Phix}}: "count only" version removed, since it no longer manages anything the "full" version cannot)
m (→‎Math solution: Fix bugs)
Line 372: Line 372:
Dim i As Integer
Dim i As Integer
For i = 1 To n
For i = 1 To n
tot = tot + a(i)
tot = tot + arr(i)
Next i
Next i
res = factorial(tot)
res = factorial(tot)
For i = 1 To n
For i = 1 To n
res = res / factorial(a(i))
res = res / factorial(arr(i))
Next i
Next i
getLantern = res
getLantern = res