-
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
unknown
committed
Oct 30, 2018
1 parent
67d5e8c
commit afc3b84
Showing
1 changed file
with
11 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
func main() { | ||
fmt.Println(phi(1000)) // number of iterations | ||
} | ||
|
||
func phi(args... float64) float64 { if iters := args[0]; iters > 0 { return func() float64 { if len(args) == 1 { return phi(iters - 1, 1 + 1.0 / 1)} else {return phi(iters - 1, 1 + 1.0 / args[1])} }()} else { return args[1]}} |