This commit is contained in:
joachimschmidt557 2019-02-23 21:57:43 +01:00
parent 7561d34d8d
commit 2b1d879eeb
3 changed files with 17 additions and 0 deletions

13
Euklid.fs Normal file
View file

@ -0,0 +1,13 @@
module Euklid
open System
let rec euklid a b =
if b = 0 then a
else euklid b (a % b)
let rec erwEuklid a b =
if b = 0 then (a, 1, 0)
else
let (d, x, y) = erwEuklid b (a % b)
(d, y, x - (a / b) * y)

View file

@ -6,6 +6,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="OtherFile.fs" /> <Compile Include="OtherFile.fs" />
<Compile Include="BetterThanRacket.fs" /> <Compile Include="BetterThanRacket.fs" />
<Compile Include="Euklid.fs" />
<Compile Include="Program.fs" /> <Compile Include="Program.fs" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -103,4 +103,7 @@ let main argv =
printfn "%b" (BetterThanRacket.BinaryTreeHausübung.BinaryTreeContains 56 BinaryTreeHausübung.smallTree) printfn "%b" (BetterThanRacket.BinaryTreeHausübung.BinaryTreeContains 56 BinaryTreeHausübung.smallTree)
printfn "%A" (Euklid.euklid 128 36)
printfn "%A" (Euklid.erwEuklid 128 36)
0 // return an integer exit code 0 // return an integer exit code