Popular problem

From Esolang
Jump to navigation Jump to search

Some problems, of varying degrees of complexity, are very popular targets for esoteric programmers. Programs solving these problems are usually the first, and often the only, programs to be implemented in a new esoteric programming language.

Some of the popular problems are:

  • Hello, world! - Print "Hello, world!".
  • 99 bottles of beer - Print the text of the "99 bottles of beer" song.
  • Quine - Output program's own source code.
  • Fibonacci sequence - Output the Fibonacci numbers (1,1,2,3,5,8,13...) using either recursion or iteration.
  • Factorials - Calculate n! for an arbitrary n, or output the sequence (1!,2!,3!,...), where n! = 1*2*...*n.
  • Prime numbers - Output the sequence of prime numbers (2,3,5,7,11,13,17...) using e.g. the Sieve of Eratosthenes (or just brute force.)
  • Disan Count - Ask the user to input a value and then print all the even numbers between 0 and that value.
  • Cat program - Copy standard input to standard output.
  • Digital root calculator - Calculate and print out the digital root of given input.
  • Mandelbrot set - Output the Mandelbrot fractal, usually in ASCII pseudographics.
  • Equivalency simulation - Interpret a language with a known computational class, e.g. Brainfuck, to prove that the language is in the same class, e.g. Turing-complete.
  • Interpreter - Interpret Befunge or some other esoteric programming language not to demonstrate anything in particular, just for fun. An especially popular choice, for fairly esoteric reasons, is Deadfish.
  • Bootstrap - Interpret or compile the language in which the program is written.
  • ROT13 encoder/decoder - Apply the ROT13 cipher to the input text.
  • Pi calculator - Calculate π to an arbitrary precision.
  • Truth-machine - Get input, if 0, output '0' and quit, if 1, output '1' infinitely.
  • FizzBuzz - Displays a series of numbers. However, any number divisible by three is replaced by the word Fizz and any divisible by five by the word Buzz. Numbers divisible by both become FizzBuzz.
  • Infinite loop - Make an infinite loop. Itself or its variations are embedded in various popular problems. (That is why it should also be a popular problem.)
  • Looping counter - Count from a specified constant to any constant.

Other popular types of programs are:

  • Palindromes - Programs that read the same forwards and backwards.
  • Polyglots - Programs that run in multiple languages.