Re: Finding the position of the number
- From: quasi <quasi@xxxxxxxx>
- Date: Wed, 31 May 2006 01:53:00 -0400
On Tue, 30 May 2006 16:03:19 -0400, quasi <quasi@xxxxxxxx> wrote:
On 30 May 2006 12:44:08 -0700, "Pubkeybreaker"
<Robert_silverman@xxxxxxxxxxxx> wrote:
Atrus wrote:
Is there any formula that I could use that would find the position of a
number in a large sequence of numbers.
For example to find ' 11 ' in the string of numbers 1234567891011, some
formula would return the number 12, does anyone know of a formula that
would do this?
Thanks!
This has got to rank as one of the most clueless questions I've
ever seen within this newgroup. And I've been reading it for over
20 years.
Of course there's no method that would work in general, except for
brute force search. Even then, assuming the substring does not exist,
how would you know when to stop?
However for the _specific_ infinite string given above:
12345678910111213...
it's a reasonable to ask if there are formulas for
f(s) = the first location of a given substring s
c(s) = the canonical location of a given substring s
Thus, for example:
f(12)=2
c(12)=14
If not a formula, then at least a procedure which is faster than brute
force search.
quasi
For a given positive integer n, let s(n) be the base 10 string
representation of n, and let c(n) be the location of the canonical
occurrence of s(n) as a substring of the infinite string
12345678910111213...
Then c(n) is given by the formula:
c(n) = n*k(n) - ((10^k(n) - 10)/9)
where k(n) = floor(log_10(n)) + 1
quasi
.
- Follow-Ups:
- Re: Finding the position of the number
- From: Atrus
- Re: Finding the position of the number
- References:
- Finding the position of the number
- From: Atrus
- Re: Finding the position of the number
- From: Pubkeybreaker
- Re: Finding the position of the number
- From: quasi
- Finding the position of the number
- Prev by Date: Re: JSH: Learning consensus
- Next by Date: People's acquired taste for the Golden Rectangle
- Previous by thread: Re: Finding the position of the number
- Next by thread: Re: Finding the position of the number
- Index(es):
Relevant Pages
|