You are developing some code to generate ID numbers. Policy requires that no ID numbers include the digit sequence 666.
Create a function (or your language's equivalent) which takes a positive integer parameter and returns the next integer that does not include 666 when that integer is expressed in decimal. (60606 is fine, 66600 is not.)
Your code must not use a loop that adds one until it finds a result that fits the rules.
f(1) returns 2. f(665) returns 667. f(665999999) returns 667000000 without having looped a million times. (Following examples added since the question was first posed.) f(666666666) also returns 667000000. f(66600) returns 66700. f(456667) returns 456670.
Replacing 666 with 667 won't work if there's more than one 666 in the input.