## Mathematical way to find a sequence of digits in an integer, programing crossover question [closed]

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.

-
This is really a Python programming question, not a math question I'm sorry to say. – Ryan Budney Jan 12 2010 at 2:39
(35344442345321456754 / 10^14) % 10^4 == 4444 – Mariano Suárez-Alvarez Jan 12 2010 at 2:46
To a mathematician there's nothing more "mathematical" about using calculator operations on a number than there is about looking at letters in a string. They're both equally mathematical and equally straightforward questions. – Noah Snyder Jan 12 2010 at 3:09
The output of an algorithm that determines a property of a string is no more and no less of a computation than the output of an algorithm that determines a property of an integer. – Qiaochu Yuan Jan 12 2010 at 5:49
There might be an interesting question here... What are the constraints you are working under that require you to reject the "string" solution? – Sam Nead Jan 12 2010 at 12:59