|
|
|
|
|
by darkestkhan
5045 days ago
|
|
Can't you all think for a bit? All of These solutions are
O (n) in both time and space... there is solution that will take O (1) time and space - and I think that you learned it in math class at (latest) high school (hint: arithmetic progression) |
|
One could imagine the question was actually "sum BusyBeaver(n) for n divisible by 3 and 5 between 1 and 100", i.e. no closed form. In Python:
(And yes, if one was being really pedantic, one could replace the condition with x % 15 == 0.)