Skip to main content

Questions tagged [approximation]

For challenges relating to approximating a value, typically a constant or something related to the program's input

22 votes
11 answers
3k views

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^...
Parcly Taxel's user avatar
  • 4,749
19 votes
17 answers
2k views

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 ...
Ginger's user avatar
  • 6,098
29 votes
9 answers
3k views

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, ...
Giuseppe's user avatar
  • 29.4k
14 votes
13 answers
2k views

Challenge Given a number x and a precision e, find the lowest positive integer q such that <...
Stef's user avatar
  • 957
9 votes
5 answers
777 views

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 ...
simonalexander2005's user avatar
49 votes
22 answers
6k views

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 ...
Arnauld's user avatar
  • 206k
25 votes
6 answers
2k views

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 ...
trichoplax is on Codidact now's user avatar
4 votes
22 answers
2k views

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 ...
Luc H's user avatar
  • 559
10 votes
19 answers
1k views

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 ...
Stan Strum's user avatar
26 votes
25 answers
2k views

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 ...
Wheat Wizard's user avatar
  • 103k
27 votes
19 answers
2k views

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

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 ...
NonlinearFruit's user avatar
10 votes
3 answers
699 views

Goal Generate (N) random line segments of uniform length (l), check if they cross the equidistant (...
NonlinearFruit's user avatar
38 votes
23 answers
4k views

Goal Create a program/function that takes an input N, check if N random pairs of integers are relatively prime, and returns <...
NonlinearFruit's user avatar
13 votes
16 answers
984 views

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) ...
miles's user avatar
  • 17.3k

15 30 50 per page