Linked Questions

143 votes
566 answers
46k views

Shortest infinite loop producing no output

Your task is to create the shortest infinite loop! The point of this challenge is to create an infinite loop producing no output, unlike its possible duplicate. The reason to this is because the code ...
user41805's user avatar
  • 13k
172 votes
483 answers
34k views

Implement a Truth-Machine

A truth-machine (credits goes to this guy for coming up with it) is a very simple program designed to demonstrate the I/O and control flow of a language. Here's what a truth-machine does: Gets a ...
a spaghetto's user avatar
  • 11.2k
192 votes
175 answers
19k views

What is the smallest positive base 10 integer that can be printed by a program shorter (in characters) than itself?

I think the question as above is clear, but just in case: Write a full program (not just a function) which prints a positive base 10 integer, optionally followed by a single newline. Qualifying ...
Arandur's user avatar
  • 1,939
239 votes
115 answers
43k views

Print every character your program doesn't have

Your task is to build a program (using only printable ASCII characters and/or tabs and newlines) that prints out exactly the characters in the printable ASCII space (...
Joe Z.'s user avatar
  • 34.6k
32 votes
101 answers
7k views

Print the ASCII table

The task is to display n characters of the ASCII table. You may write a function (or a program that takes the argument as a parameter, STDIN is allowed as well) that takes a parameter n, which will ...
oopbase's user avatar
  • 582
49 votes
35 answers
2k views

PPCG Jeopardy: Cops

How well do you know the site? Let's find out. This is a cops-and-robbers challenge. Robber's thread. As a cop, you need to: Find a non-deleted, non-closed challenge on this site to answer. The ...
Nathan Merrill's user avatar
25 votes
29 answers
3k views

Different Way Forward

Given a list of integers produce a Forward Difference at a specified order/depth. For the list of integers: (10, 18, -12, 4, 8, -3, -5, 67, 9, 14) The Forward ...
MickyT's user avatar
  • 12.2k
29 votes
26 answers
1k views

Natural construction

The natural numbers including 0 are formally defined as sets, in the following way: Number 0 is defined as the empty set, {} For n ≥ 0, number n+1 is defined as n ∪ {n}. As a consequence, n = {0, 1, ...
Luis Mendo's user avatar
  • 104k
27 votes
29 answers
1k views

Substring Sum Set

Introduction Let's observe this array: [3, 2, 4, 1, 1, 5, 1, 2]. Each element displays the length of the substring which must be summed up. Let's take a look at ...
Adnan's user avatar
  • 44.2k
42 votes
16 answers
7k views

Use xkcd's formula to approximate the world population

In xkcd 1047, Randall Munroe lists "slightly wrong" approximations of assorted quantities and numbers with varying precision and complexity, such as that the number of liters in a gallon is very close ...
NinjaBearMonkey's user avatar
41 votes
9 answers
6k views

"Convenient palindrome" checker

If you've ever tried to write palindromic code before, you'd know how much brackets tend to get in your way. ()() is not a palindrome, even though it kinda looks ...
algorithmshark's user avatar
23 votes
15 answers
4k views

Keep the unique characters down

It's very simple: Your program or function should generate the following text: ...
durron597's user avatar
  • 4,790
19 votes
19 answers
3k views

Calculate hamming weight with low hamming weight

Create a program that computes the hamming weight of a string. Winner is the program with the lowest hamming weight. Rules: Hamming weight for an ASCII character is defined as the total number of ...
Polynomial's user avatar
  • 4,506
16 votes
14 answers
1k views

Evaluating the score based from a chess FEN string

Challenge Forsyth–Edwards Notation (FEN) is a standard notation for describing a particular board position of a chess game. Your challenge is to evaluate the score using the FEN string. This is an ...
Adnan's user avatar
  • 44.2k
10 votes
20 answers
970 views

Calculate probability of getting half as many heads as coin tosses.

Write a program that, given a small positive even integer from standard input, calculates the probability that flipping that many coins will result in half as many heads. For example, given 2 coins ...
david4dev's user avatar
  • 693

15 30 50 per page