We’re rewarding the question askers & reputations are being recalculated! Read more.

# Questions tagged [pi]

This challenge involves the mathematical constant pi.

52 questions
Filter by
Sorted by
Tagged with
6k views

486 views

### Pi Day: Determine if a list of words is correct Pilish

Background Though this is a bit late for Pi Day, I saw an article about Pilish and thought it would make a great challenge. Pilish is created by using a sequence of words where each word's length ...
1k views

### Output with the same number of digits of pi as the length of the code

Your challenge is to print x digits of pi where x is your code length. Examples: ...
6k views

Challenge : Pi is supposed to be infinite. That means every number is contained inside the decimal part of pi. Your task will be to take a positive integer on input and return the position of this ...
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 ...
351 views

### Without using numbers, Calculate Pi [duplicate]

Inspired by Nicola Sap's Challenge Goal Your challenge is to simply produce π with 232-1 digits. However today's twist, like the title implies, is to produce it without using any numbers or any π ...
4k views

### Print the n-th digit of pi [duplicate]

Task Given an input n, calculate the n-th decimal digit of pi Rules Answer can be a full program or a function. Input must be taken from stdin or from function ...
418 views

### Calculate the sum of all odd digits of pi in range [duplicate]

Introduction In the not so distant future with the AI revolution, we will need a way to solve their captchas to prove we're not humans. This challenge was inspired by CommitStrip. Challenge One ...
427 views

### Integers in Base Pi

Background: Pi (π) is a transcendental number, and therefore it has a non-terminating decimal representation. Similar, the representation doesn't terminate if ...
3k views

### Shorten an already short mathematical expression

For once, I was doing some real work, updating old code, and bumped into an expression that is equivalent to what would be written as πx + ex in good old-fashioned math. I thought it would be possible ...
7k views

### Bake a slice of Pi

Write a program or function that prints or outputs this exact text (consisting of 142 characters): ...
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 <...
519 views

### Natural Pi #1 - Sand

Goal Generate (N) random line segments of uniform length (l), check if they cross the equidistant (...
7k views

### Calculate pi to 5 decimals

This comes from http://programmers.blogoverflow.com/2012/08/20-controversial-programming-opinions/ "Given that Pi can be estimated using the function 4 * (1 – 1/3 + 1/5 – 1/7 + …) with more terms ...
16k views

### Output Pi without math [closed]

In as few bytes as possible, your job is to write a program that outputs: 3.14 In celebration of a late Pi day of course! :) Rules You can do it anyway you ...
1k views

### Transmit Pi… precisely

Following on from Monte Carlo estimator of Pi this challenge is to produce the shortest code for the constant Pi. Except here your code must output consecutive digits of pi forever. This is code ...
2k views

### Sort digits by their first occurrence in pi

Given a non-negative number n, sort the digits of n by their first occurrence in pi. Input can be taken via function cli ...
1k views

### Co-primality and the number pi

Introduction Number theory is full of wonders, in the form of unexpected connections. Here's one of them. Two integers are co-prime if they have no factors in common other than 1. Given a number N, ...
1k views

### Play the sound of Pi

Yup, you read the title right. play the sound of pi. More specifically, for every digit of pi in the first 1000, map it to a musical note and output the resulting melody to a file. Basically, each ...
199 views

### Calculate PI to n digits [duplicate]

There have been many questions asking for variations on how to write Pi but none are like this... EDIT: There are many questions asking for the nth digit of Pi, I am asking for UPTO the nth digit. ...
778 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 ...
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 ...
367 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 ...
1k views

### A Triangular Slice of Squared Pi

Inspired by Bake a slice of Pi Challenge Given input 3 <= n <= 100 and 3 <= y <= n, construct an ...
9k views

### π Day puzzle for 3/14

Happy π Day. The goal of this question is to calculate the area for a circle of radius 3, where A = πr². The catch is that you have to use the constant π that is defined in a different language than ...
846 views

### Runs of Digits in Pi

Your goal is to output the strictly increasing sequence of consecutive, identical digits of pi (π). Each term in the sequence must be one digit longer than the previous. So ...
717 views

### Pi Bowling to 10 in 10 [closed]

Your Goal: Estimate pi to at least 10 decimal places. The format is your choice - it can output as a number, as a string, as an output to STDOUT, etc. Seems easy, right? But wait, it's not as simple ...
7k views

### Happy Rounded Pi Day

To celebrate Rounded Pi Day, you must take advantage of today's date to make a program that takes in a circle's diameter and outputs its circumference by multiplying the diameter by 3.1416, where 3....
4k views

### Map a random number to pi

A double precision representation of a decimal can only guarantee an accuracy of 15 decimal places, thus pi is approximated as: 3.141592653589793 You can see ...
1k views

### Pi Day, Pi Minute, or Pi Second?

In this challenge you will need to determine whether it's Pi Day, Pi Minute, or Pi Second. Because Pi is irrational, it wants your code to be as short as possible. Examples No input is provided, ...
6k views

### Quiche Lorraine [closed]

Since it was Pi day recently, I have noticed a number of challenges that ask you to calculate pi. Of course, a quiche lorraine is not quite a pie (you can claim a Bonus Score¹ of +1 if you guessed ...
2k views

### stupid restrictions and desert

So, you were sitting at your desk, golfing a program to calculate the first 20 digits of pi, and along comes your boss and throws your apple IIe out the window. You are now working on a new project ...
2k views

### Calculate π with quadratic convergence

Write a function or complete program that takes a positive number n and performs n steps of an iterative algorithm for ...
580 views

### Computing truncated digits sums of powers of pi

Given a positive integer n output the sum of the first n decimal digits of the fractional part of πn. Example input and outputs: 1 → 1 2 → 14 3 → ...
8k views

### Pi is still wrong [closed]

Pi is Wrong A common method of computing pi is by throwing "darts" into a 1x1 box and seeing which land in the unit circle compared to the total thrown: ...
3k views

### Calculate digits of Pi

This is a somewhat different task. Calculate 1024 hexadecimal digits of π, beginning at the 1024th hexadecimal place. Formally: Your program should complete in less then 1 minute and produce the ...
706 views

### Memory is Expensive [closed]

You are a robot. You are stranded in a small cage with weird humans wearing weird suits looking at you. Your solar panel is malfunctioning, and your energy is running out. On the wall there is a ...
415 views

### Calculate a pi-based sequence with a pi-based frequence

Introduction Pi is 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089... Let's treat each digit as an instruction as to how to ...
934 views

### Piem validator programme

Write a program that defines a function that can check if a string variable called "anything you want or inputted by the user" is or not a piem. (piem = a story or poem in which the word lengths ...
1k views

### 5 Seconds to Find Pie

Pi times e (or Pie if you like ambiguous notation) to 100 decimal places is: ...
681 views

### Pirrational Numbers

Pi is an irrational number, which means that its decimal representation never terminates or repeats itself. Pi truncated to 41 decimal digits (40 places) is ...