Skip to content

Instantly share code, notes, and snippets.

@johnmyleswhite
Created November 15, 2022 00:28
Show Gist options
  • Save johnmyleswhite/48100a7ce2815d4516ad3456fef538f0 to your computer and use it in GitHub Desktop.
Save johnmyleswhite/48100a7ce2815d4516ad3456fef538f0 to your computer and use it in GitHub Desktop.
Prime Sequence Generator
julia> import Printf: @printf
julia> f(x) = 1 / (x - floor(Int, x))
f (generic function with 1 method)
julia> function g(n, x₀ = 0.43233208718590286890)
x = x₀
for i in 1:n
x = f(x)
@printf("%d\t%s\n", i, x)
end
end
g (generic function with 2 methods)
julia> g(10)
1 2.313036736433583
2 3.1945132427361935
3 5.1410381418412685
4 7.090280593213223
5 11.076577638764679
6 13.05864239393663
7 17.052509846044487
8 19.04404745641027
9 22.702786528369735
10 1.4229071839491794
julia> g(10, big"0.43233208718590286890")
1 2.313036736433582906433460682246375555777444498479108023786844513497829188104021
2 3.194513242736193312385745111386897947790622512117362648963959180241063800937822
3 5.141038141841274237033261779007090813962257509354120656967884568785898567025052
4 7.090280593212935241347552787973951414421291526444553649730859375358098804369252
5 11.07657763880002723483672521256701384107349905954244026664282913435664469232065
6 13.05864238790873178511626250010483901967984234108259986566062796366647646569838
7 17.05251159888564382668934064612946382388796234806435827443274240365514313782536
8 19.043411764660445708114110369295474990984355434225214191438162667218449811997
9 23.03523037641319902315233321434243892061376426543991096541358321167426274578631
10 28.38459595979085425715453608107983099450990319792313745690370214657719899330091
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment