Update problem477.R

Strategy simplified, works for f(100), still doesn't work for f(10000)