Find a Sequence in the Digits of π
The new functions SequenceCases, SequencePosition, and SequenceCount offer new functionality to extract sequences using pattern matching.
Find the occurrence of the first release date of Mathematica in the digits of .
In[1]:=
EntityValue[
Entity["ProgrammingLanguage", "WolframLanguage"], "DateIntroduced"]
Out[1]=
Change this date to a format suited to the search.
In[2]:=
EntityValue[
Entity["ProgrammingLanguage", "WolframLanguage"], "DateIntroduced"];
date = Characters[DateString[%, {"Month", "Day", "YearShort"}]]
Out[2]=
Generate the first three million digits of .
In[3]:=
pi = Characters[ToString@N[Pi, 3000000]];
SequencePosition gives the positions at which the formatted date starts and ends.
In[4]:=
pos = SequencePosition[pi, date]
Out[4]=
It appears only once in the first three million digits of . This occurrence can be represented in a simple way using a Grid object.
show complete Wolfram Language input
In[6]:=
Grid[Partition[chars, 8]]
Out[6]=
Try other dates and find your day here!