##### π in Kotlin

I think I'm pretty much doing pi approximations in every language now, and I recently learned that Kotlin is expected to beat Java in Android development, so I decided to learn the basics of Kotlin, and here is pi in Kotlin!

Here are the other approximations so far:
Ruby - https://repl.it/talk/share/p-in-Ruby/34982
Java - https://repl.it/talk/share/p-in-Java/34978
QBasic - https://repl.it/talk/share/p-in-QBasic/34973
Fortran - https://repl.it/talk/share/p-in-Fortran/34890
APL - https://repl.it/talk/share/p-in-APL/34888
Forth - https://repl.it/talk/share/p-in-Forth/34652
LOLCODE - https://repl.it/talk/share/p-in-LOLCODE/34421
Python and Node.js (Node is linked in post) - https://repl.it/talk/share/2-Approximations-of-p-In-Only-Four-Lines-of-Code/32773
C - https://repl.it/talk/share/p-Approximations-in-C/33461

Credit to @TheForArkLD , @Warhawk947 , and @LizFoster for inspiring these approximations. Most of these use the Nilakantha Series, although I also use the arctangent method (multiplying the radian arctangent of 1 by 4 to get pi and getting the arctangent with an infinite series) in three of them (Python, Node, and C).

You are viewing a single comment. View All
AtriDey (189)

I actually did a Nilakantha series in Python a day before I saw this, but I got 3.14159265358984 instead of 3.14159265358979.

AmazingMech2418 (1087)

@AtriDey Try increasing the iterations. :)

AtriDey (189)

@AmazingMech2418 It's going infinitely, and it just stopped there. maybe if I leave it for a day to do more iterations... -_-

AmazingMech2418 (1087)

@AtriDey Maybe? I don't know. I did one in Python too a while back (see the list in this post).

AtriDey (189)

@AmazingMech2418 I would get to start running the repl but now nothing works, I broke repl.it again. Fourth time this week; and it's only Tuesday.

AmazingMech2418 (1087)

@AtriDey What do you mean you broke Repl.it? Is that why the connections are failing?

AtriDey (189)

@AmazingMech2418 Wait, it fails for you too? I guess repl.it is down, Cloudfare gave me some sort of notice when I checked the markdown doc.

AtriDey (189)

@AmazingMech2418 My brain is broken the fifteenth time this week, and it's only Wednesday.

AmazingMech2418 (1087)

@AtriDey I'm getting the "Failed to connect, retrying notifications".

AtriDey (189)

@AmazingMech2418 Same. Guess it's time to torture the repl.it team by joining the crusade of error reports.

AmazingMech2418 (1087)

@AtriDey LOL! I don't think that is necessary...