# Using julia to calculate Ramanujan constant

**URL:** <https://discourse.julialang.org/t/using-julia-to-calculate-ramanujan-constant/110578>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 22, 2024, 1:40pm UTC](https://discourse.julialang.org/t/using-julia-to-calculate-ramanujan-constant/110578 "2024-02-22T13:40:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiang\_ming\_zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jiang_ming_zhang/32/204063_2.png) [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Post date:** [February 22, 2024, 1:40pm UTC](https://discourse.julialang.org/t/using-julia-to-calculate-ramanujan-constant/110578/1 "2024-02-22T13:40:09Z")

</div>

> **[Ramanujan Constant -- from Wolfram MathWorld](https://mathworld.wolfram.com/RamanujanConstant.html)**
>
> The irrational constant R = e^(pisqrt(163)) (1) = 262537412640768743.9999999999992500... (2) (OEIS A060295), which is very close to an integer. Numbers such as the Ramanujan constant can be found using the theory of modular functions. In fact,...

We should use BigFloat to get so many digits, right? But how?

---

<div class="post-metadata">

**Author:** ![fgerick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fgerick/32/13228_2.png) [@fgerick](https://discourse.julialang.org/u/fgerick)\
**Post date:** [February 22, 2024, 1:45pm UTC](https://discourse.julialang.org/t/using-julia-to-calculate-ramanujan-constant/110578/2 "2024-02-22T13:45:39Z")

</div>

Here are plenty of digits:

```julia
julia> setprecision(10000)
10000

julia> exp(π*√(big(163)))
2.62537412640768743999999999999250072597198185688879353856337336990862707537410378210647910118607312951181346186064504193083887949753864044905728714477196814852322432039116478291488642282720131178317065010452226878014448417703469694633557076817238876810009237065395193865063627576578885582239481142769121008308866511072847106234658112981830124591328361000649826659236517261788308637107864521955281542746651096110014725020979046393817787125750098036577922306431216511310873805992982423355849456123995676999784359648640960032664824435213064915993032705307532565686183882654833098028466962428738847518444368385307341150444694788400594644691316821205929460545421637548918900601503568728629331400636322681463516121637648641314293423516002141805135282877319601798139178844071506629949190934962773962072341353025575781802811802102063409749939238372903303617398166336003226126208866641171805383285589700027357226452332870106495863677266986873848591656982662617419885511568443033273512310324330757273316495361526204826847983060539810031577598025111445957741835964890942202034771967784830822450070191182061084787762257358785844023190919532164207634140056803994315465266737943502169921347477132611285191331784916066580684034897878144313226794108395193602650289607265372912762269382427175512782796537507007840011900192417133583271347015187569523189505775228961496828216507821668556052186222837615110452907046519813506240640156995550556077235272358983592679938209053241840589127448014394745709506475865551947560663471079783666129276479209096879031318655542827320626065932484132615237058900982753707153736307725808127558269208725915819020050397511927262814205152958482846286048407148067499337568975481698979116612503207383996329471974750660807439122822516102987153121539286732890564551685110945108502418688133577539383199887513162573447999411081187400967706825774509505927951779005342292276251351576713933525535086981936495381533882398707596797647682509134424272115375629460935727800280745118897358443122599407358563993717848299901945519745321633069189498542849710837603600608828114235897001077643877578733878950692797405961851003017633105573378618678923872350454870362037553487804163736643576180351328425704227708279579355956174061772307553509727186549179583326042070541263151861549349077882728989304658802488155106836245106269219655994100896232822232018612596790576998153167772334236774091368791267078548127063662825424002995550785931392833178527958011221382085406265273112973278125698756202039698030987141398117312227206581908497047752518356812091709691464456249553876716694034140997958048105416598915733667007269547603222084782795450538083822480222769666987622259346914552717948704046549955348500295773209991666323106872582059437578266563064509261872667311342828509306640579875872796213507019151082431137661516196133034335772268815078033961656563667618856449527935651003136541351268060076985638581389665208983465556644136927645178284770730914145028053798660830238085582133567552325827810870152478104518731920176125106167456e+17

```

---

<div class="post-metadata">

**Author:** ![mihalybaci](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mihalybaci/32/13528_2.png) [@mihalybaci](https://discourse.julialang.org/u/mihalybaci)\
**Post date:** [February 22, 2024, 1:48pm UTC](https://discourse.julialang.org/t/using-julia-to-calculate-ramanujan-constant/110578/3 "2024-02-22T13:48:01Z")

</div>

I have also seen people recommend the ArbNumerics.jl when needing both precision and performance. (Though I have not used the package myself.)
