OFFSET
1,3
LINKS
Peter Trüb, 22.4 trillion digits of pi.
FORMULA
EXAMPLE
Fibonacci(4) is 3, 3 appears for the first time in decimals of Pi in position 9, so a(4) = 9.
MATHEMATICA
(* Determine the decimal digits of Pi following the decimal point. *)
decimalPiDigits[n_] := First@RealDigits[Pi, 10, n, -1];
(* Find the position of first occurrence of 'sublist' in 'list', or Indeterminate if it doesn't occur. *)
firstPosition[sublist_, list_] :=
With[{p = SequencePosition[list, sublist]},
If[Length[p] == 0, Indeterminate, First@First@p]];
(* Find the first occurrence of the given digits in the decimal digits of Pi by calculating ever more digits of Pi, as needed. *)
findDigitSequenceInDecimalPiDigits[seq_] :=
First@NestWhile[
With[
{
numdigits = Max[1, 2*Last[#]] (*
How many digits will we calculate in this iteration? *)
},
{firstPosition[seq, decimalPiDigits[numdigits]], numdigits}
] &,
{Indeterminate, 0},
Not@*IntegerQ@*First
];
(* Find the first 30 entries. *)
Table[findDigitSequenceInDecimalPiDigits[
IntegerDigits@Fibonacci[n]], {n, 1, 30}]
(* Sidney Cadot, Feb 25 2023 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Vicente Izquierdo Gomez, Sep 11 2012
EXTENSIONS
a(31)-a(40) from Pontus von Brömssen, Aug 31 2024
STATUS
approved