Pi: Difference between revisions
Content added Content deleted
m (→{{header|11l}}: updated syntaxhighlight lang=) |
m (→Translation of Haskell: updated syntaxhighlight lang=, etc...) |
||
Line 2,141: | Line 2,141: | ||
===Translation of Haskell=== |
===Translation of Haskell=== |
||
{{trans|Haskell}} |
{{trans|Haskell}} |
||
< |
<syntaxhighlight lang=fsharp>let rec g q r t k n l = seq { |
||
if 4I*q+r-t < n*t |
if 4I*q+r-t < n*t |
||
then |
then |
||
Line 2,154: | Line 2,154: | ||
Seq.take 1 π |> Seq.iter (printf "%A.") |
Seq.take 1 π |> Seq.iter (printf "%A.") |
||
// 6 digits beginning at position 762 of π are '9' |
// 6 digits beginning at position 762 of π are '9' |
||
Seq.take 767 (Seq.skip 1 π) |> Seq.iter (printf "%A")</ |
Seq.take 767 (Seq.skip 1 π) |> Seq.iter (printf "%A")</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999</pre> |
|||
<pre>3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066 |
|||
470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831 |
|||
652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903 |
|||
600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527 |
|||
248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051 |
|||
320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219 |
|||
6086403441815981362977477130996051870721134999999</pre> |
|||
===As an Unfold=== |
===As an Unfold=== |
||
Haskell can probably do this as an unfold, it has not so I shall in F# |
Haskell can probably do this as an unfold, it has not so I shall in F# |