Questions tagged [approximation]
For challenges relating to approximating a value, typically a constant or something related to the program's input
23 questions
22
votes
11
answers
3k
views
How powerful must this e approximation be?
This challenge was inspired by this non-challenge about the natural logarithm base \$e\$ and the following pandigital approximation to \$e\$ appearing on a Math Magic page:
$$\left|(1+9^{-4^{7×6}})^{3^...
19
votes
17
answers
2k
views
Approximate my atomic weight
Each element on the periodic table of the elements has an atomic weight. For example, boron (element 5) has an atomic weight of 10.81. Your challenge is to write a program which takes as input the ...
29
votes
9
answers
3k
views
Approximate when you are going to die
A mortality table or life table is an actuarial tool that gives the probability that a person aged \$A\$ years will die in the next year, and is used to help calculate the premiums for life insurance, ...
14
votes
13
answers
2k
views
Diophantine Approximation: find lowest possible denominator to approximate within given precision
Challenge
Given a number x and a precision e, find the lowest positive integer q such that <...
9
votes
5
answers
881
views
The first digit of a to the power of b (approximately)
Inspired by This answer to a Puzzling question
Background - exponentiation by squaring
If you don't want to read the background, or don't understand it, there's a worked example in Java, linked at ...
49
votes
22
answers
6k
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 ...
25
votes
6
answers
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 ...
4
votes
22
answers
2k
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
19
answers
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 ...
26
votes
25
answers
3k
views
Approximate the Dottie number to arbitrary precision
The Dottie number is the fixed point of the cosine function, or the solution to the equation cos(x)=x.1
Your task will be to make code that approximates this constant. Your code should represent a ...
27
votes
19
answers
2k
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 ...
12
votes
3
answers
536
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
3
answers
711
views
Natural Pi #1 - Sand
Goal
Generate (N) random line segments of uniform length (l), check if they cross the equidistant (...
38
votes
23
answers
4k
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 <...
13
votes
16
answers
1k
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\$ Fibonacci numbers.
$$g(n) ...