I am trying to find a way to mathematically discover if an integer(of know length) has a specific sequence of digits in a known location, that is I know to look at digits 4-8. For example lets say I have numbers of length 20 and I would like to know it if digits 4,5,6,7 are all 4's. For 35344442345321456754 it is true.
I am attempting to write a program to do this in python. I is possible for me to convert the integer to a string and look for the patter in the string. I don't want to do this. I would like a purely mathematical solution.
I can't help but think there is an obvious way to do this so I am hoping this will be an easy answer for someone.
I hope this question is appropriate at mathoverflow, I am kinda new to the site and the quality of questions and answers are impressive.

