# Birthday in Pi

**URL:** <https://discourse.julialang.org/t/birthday-in-pi/69590>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 11, 2021, 11:11pm UTC](https://discourse.julialang.org/t/birthday-in-pi/69590 "2021-10-11T23:11:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jesus-117](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jesus-117/32/29446_2.png) [@Jesus-117](https://discourse.julialang.org/u/Jesus-117)\
**Post date:** [October 11, 2021, 11:11pm UTC](https://discourse.julialang.org/t/birthday-in-pi/69590/1 "2021-10-11T23:11:22Z")

</div>

Hi! , recently I have been curious about how to do exercises from MatLab to Julia and I started doing the birthday day in pi, in MatLab there is the function “SequencePosition” that helps in this type of problems. My question is if there is something similar in Julia  
Code in MatLab:

```julia
SequencePosition[First[RealDigits[Pi, 10, 1000000]], {1, 1, 1, 7, 9, 9}]
# With 1000000 Decimals of pi and {1, 1, 1, 7, 9, 9} the birthday

```

How I started the problem in Julia

```julia
setprecision(BigFloat, 20000000) do
    a=BigFloat(pi)
end

```

But I don’t know how to move on

---

<div class="post-metadata">

**Author:** ![stillyslalom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stillyslalom/32/45687_2.png) [@stillyslalom](https://discourse.julialang.org/u/stillyslalom)\
**Post date:** [October 11, 2021, 11:54pm UTC](https://discourse.julialang.org/t/birthday-in-pi/69590/2 "2021-10-11T23:54:11Z")

</div>

That looks like Mathematica, not Matlab? You could do this with a regex.

```julia
julia> function pi_str(n)
           setprecision(Int(ceil(log2(10) * n))) do
               string(BigFloat(pi))
           end
       end

julia> m = match(r"(111799)", pi_str(10^6))
RegexMatch("111799", 1="111799")

julia> m.offset
123957

```
