OFFSET
0,1
LINKS
Harvey P. Dale, Table of n, a(n) for n = 0..1000
EXAMPLE
In binary, Pi = 11.00100100.... The bitstring 10 (for 2) occurs at position 2, so a(2) = 2.
MATHEMATICA
p = RealDigits[Pi, 2, 500][[1]]; L = {}; Do[t = SequencePosition[p, IntegerDigits[n, 2], 1]; If[t == {}, Break[], AppendTo[L, t[[1, 1]]]], {n, 0, 65}]; L (* Giovanni Resta, Mar 16 2020 *)
Module[{nn=500, bp}, bp=RealDigits[Pi, 2, nn][[1]]; Table[ SequencePosition[ bp, IntegerDigits[n, 2], 1][[All, 1]], {n, 0, 70}]]//Flatten (* Harvey P. Dale, Sep 18 2021 *)
PROG
(Perl)
#! /usr/bin/perl
# Feed b004601.txt to this to get the binary digits of Pi.
while (<>) {
chomp;
(undef, $d[$n++]) = split(" ");
}
$pi = join("", @d);
$k = 0;
while (1) {
last if ($pos = index($pi, sprintf("%b", $k++))) < 0;
$out .= $pos +2 . ", ";
}
print $out, "\n";
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Thomas König, Mar 02 2020
STATUS
approved