Boston Numbers getting wrong in some cases

Code link

It gives WA for several cases like the ones that are provided in the question

The first few such numbers are 4,22 ,27 ,58 ,85 ,94 and 121

Sorry to bother you, I didn’t understand the ques that time.:persevere::persevere: