Count the number of digit 7 in number 1 through n

Suppose the result is f(n)
First computer f(1), f(10), f(100),...
Then use recursion. Always take off the first digit of n
Check if an input string matches the pattern

"bigboyboybig" matches "ABBA"