Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [approximation]

For challenges relating to approximating constants/other numbers.

45
votes
20answers
5k views

“As we travel the universe…”

You'll be given the name of one of the 20 biggest objects in the Solar System. Your task is to return an approximation of its radius, expressed in kilometers. This is a code-challenge where your ...
26
votes
6answers
2k views

Two dozen kissing number approximations

Given a number from 1 to 24, output the kissing number to the best of current knowledge (some numbers will have more than one acceptable output). Knowledge of geometry is not essential as the outputs ...
3
votes
22answers
1k views

rounding numbers

Task Given a number between 0 and 1 and another integer, print the approximated value of the first number rounded off to the specified number of digits given by the second integer. For example, if ...
10
votes
17answers
1k views

Approximate My Squares

Inspired by this video by tecmath. An approximation of the square root of any number x can be found by taking the integer square root ...
25
votes
16answers
1k views

Approximate Brun's Constant

Brun's constant is the value to which the sum of the reciprocals of twin prime pairs (1/p and 1/(p+2) where ...
13
votes
3answers
350 views

Natural Pi #2 - River

Goal Given an string with a train of hashes, calculate its total length and divide by the distance from start to finish. Simulation What are we simulating? According to this paper, the ratio of the ...
10
votes
3answers
498 views

Natural Pi #1 - Sand

Goal Generate (N) random line segments of uniform length (l), check if they cross the equidistant (...
39
votes
22answers
3k views

Natural Pi #0 - Rock

Goal Create a program/function that takes an input N, check if N random pairs of integers are relatively prime, and returns <...
11
votes
15answers
608 views

Compute the Fibonomial Coefficient

Background The Fibonacci sequence is defined as f(1) = 1 f(2) = 1 f(n) = f(n-1) + f(n-2) The Fibonorial, similar to the factorial, is the product of the first n ...
18
votes
30answers
2k views

Approximation of e

We all know that the Euler's number, denoted by e, to the power of some variable x, can be approximated by using the Maclaurin Series expansion: By letting x equal 1, we obtain Challenge Write a ...
9
votes
1answer
308 views

Approximate the Fransén-Robinson constant

Given an input n, output the value of the Fransén-Robinson constant with n digits after the decimal place, with rounding. Rules ...
24
votes
35answers
4k views

Monte Carlo estimator of Pi

Happy Pi Day everyone! For no reason at all, I'm trying to construct a Monte Carlo estimator of Pi that is as short as possible. Can we construct one that can fit in a tweet? To clarify, what I have ...
20
votes
13answers
2k views

Khinchin's constant to as many decimal places as possible in 64 bytes or less

Khinchin's constant is a curious mathematical constant that, according to Wolfram MathWold, is "notoriously difficult to calculate to high precision". Here it is to 100 digits: 2....
2
votes
2answers
736 views

Get as close to pi as you can [closed]

Your job is to write a program to find the closest number to PI. Let me clarify. You will first choose a number type. Let us say you choose ...
18
votes
68answers
8k views

Pi Calculation Code Golf [closed]

The Challenge You must calculate pi in the shortest length you can. Any language is welcome to join and you can use any formula to calculate pi. It must be able to calculate pi to at least 5 decimal ...
22
votes
11answers
2k views

Good rational approximations of pi

Write a program that prints out all the good rational approximations of pi with denominator < 1000000, in increasing denominator order. a/b is a "good rational ...