Code: (Select All)
For i = 1 To 4000
If i Mod 3 = 1 Then
i2 = i - Int(i / 3) - 1 '1st
If i2 Mod 3 = 1 Then
i3 = i2 - Int(i2 / 3) - 1 '2nd
If i3 Mod 3 = 1 Then
i4 = i3 - Int(i3 / 3) - 1 ' 3rd
If i4 Mod 3 = 1 Then
i5 = i4 - Int(i4 / 3) - 1 '4th
If i5 Mod 3 = 0 Then
Print i; "="; i2 / 2 + i5 / 2; "+"; i3 / 2 + i5 / 2; "+"; i4 / 2 + i5 / 2; "+"; 4
Exit For
End If
End If
End If
End If
End If
Next
This problem is similar to 5 Sailors, Coconuts and a Monkey at Rosetta Code. Find the minimum number to satisfy the conditions set by problem, I learned later at Syntax Bomb.
b = b + ...