given a sequence of 10 characters, how can I calculate the position number from which this sequence starts in the number of PI

example

--0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 3,1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 

my sequence is 65358 I want to get the position number - 6 which formula to apply? (without mathematics, the program is very slow. if the sequence is very far)

  • 2
    Translate pi and your number into a string. Then the problem is solved simply. - KoVadim
  • Have you seen such a resource? - angio.net/pi there this problem is quite successfully solved up to 200 million digits. I did not read, but there is a page with explanations of how it works for them: angio.net/pi/how.html - Zealint
  • Download the line with the number of Pi from somewhere (for example, here is a million characters - angio.net/pi/digits.html ) and perform a text search on it. - Kromster
  • Specify that you have a view under "without mathematics, the program is very slow"? - Kromster

2 answers 2

Since the Pi number has no regularity in the signs (at least it is stated so), no mathematics will save you.

It will only help precomputation and search. If you get a string of decimal digits in advance, you can speed up the search for a substring by using faster search algorithms for substrings, such as Knut-Morris-Pratt or Boyer-Moore (I hope there were not too many errors in the last names :))

If Pi is set in a different format, you need to look at what can help here. But in any case, in my opinion, it’s impossible to do without prediction and searching for this or that.

    Download the string with the number Pi from somewhere (for example, here is a million characters - https://www.angio.net/pi/digits.html ) and perform a text search on it.