Linked Questions

522 votes
985 answers

"Hello, World!"

So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with hello-world, and counting). While this is not the most ...
Martin Ender's user avatar
628 votes
333 answers

Produce the number 2014 without any numbers in your source code

Note to challenge writers as per meta consensus: This question was well-received when it was posted, but challenges like this, asking answerers to Do X without using Y are likely to be poorly received....
Joe Z.'s user avatar
  • 35k
244 votes
455 answers

Golf you a quine for great good!

Using your language of choice, golf a quine. A quine is a non-empty computer program which takes no input and produces a copy of its own source code as its only output. No cheating -- that means ...
Rafe Kettler's user avatar
  • 2,717
145 votes
570 answers

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
  • 13.1k
173 votes
495 answers

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
196 votes
416 answers

1, 2, Fizz, 4, Buzz

Introduction In our recent effort to collect catalogues of shortest solutions for standard programming exercises, here is PPCG's first ever vanilla FizzBuzz challenge. If you wish to see other ...
Beta Decay's user avatar
  • 23.4k
122 votes
413 answers

Print a 10 by 10 grid of asterisks

Background This is a standard textbook example to demonstrate for loops. This is one of the first programs I learnt when I started learning programming ~10 years ago. Task You are to print this exact ...
Leaky Nun's user avatar
  • 49.8k
149 votes
336 answers

Fibonacci function or sequence

The Fibonacci sequence is a sequence of numbers, where every number in the sequence is the sum of the two numbers preceding it. The first two numbers in the sequence are both 1. Here are the first ...
C. K. Young's user avatar
  • 4,937
381 votes
110 answers

Most creative way to display 42

Douglas Adams was born on March 11, 1952, and died when he was just 49. In honor of this wonderful writer, I challenge you to display 42 in the most creative way possible. You could print it in the ...
Milo's user avatar
  • 3,052
199 votes
215 answers

The Programming Language Quiz

Congratulations to Dennis who won both the cops' and the robbers' challenge! Calvin's Hobbies has already delivered on his promise and wrote this challenge for Dennis for winning the robbers' ...
Martin Ender's user avatar
112 votes
330 answers

Simple cat program

One of the most common standard tasks (especially when showcasing esoteric programming languages) is to implement a "cat program": read all of STDIN and print it to STDOUT. While this is named after ...
Martin Ender's user avatar
192 votes
180 answers

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,947
103 votes
300 answers

Create output twice the length of the code

The Challenge Write a complete program that writes twice as many bytes to standard output as the length of the program. Rules The program must write ASCII characters to the standard output. The ...
Daniel M.'s user avatar
  • 3,927
251 votes
82 answers

Code that will only execute once

Goal The goal of this challenge is to write code that will execute once and only once. This means basically that it damages the program, script, or environment in some way. If rebooting the system ...
ojblass's user avatar
  • 2,837
165 votes
128 answers

Trick or Treat polyglot

Since Halloween is coming up I thought I might start a fun little code golf challenge! The challenge is quite simple. You have to write a program that outputs either ...
BrainStone's user avatar
  • 1,531
220 votes
89 answers

Make your language unusable

Try to write some code in your language and make it not satisfying our criteria of being a programming language any more. A language satisfies our criteria (simplified version for this challenge) of ...
jimmy23013's user avatar
86 votes
219 answers

The Letter A without A

Your task is to display the letter "A" alone, without anything else, except any form of trailing newlines if you cannot avoid them, doing so in a program and/or snippet. Code that returns (instead of ...
Buffer Over Read's user avatar
87 votes
226 answers

Count up forever

Write a program that counts up forever, starting from one. Rules: Your program must log to STDOUT or an acceptable alternative, if ...
vrwim's user avatar
  • 2,509
68 votes
235 answers

Add two numbers

Input: Two integers. Preferably decimal integers, but other forms of numbers can be used. These can be given to the code in standard input, as arguments to the program or function, or as a list. ...
anna328p's user avatar
  • 6,396
73 votes
211 answers

The Programming Language Quiz, Mark II - Cops

A repost of this challenge. Meta discussion. Sandbox post. Body of the question similar to the original Robber's challenge This cops and robbers is now (08/03/2018) closed to further competing cop ...
caird coinheringaahin g's user avatar
67 votes
165 answers

Print all integers

Write a program or function which will provably print all integers exactly once given infinite time and memory. Possible outputs could be: ...
Fatalize's user avatar
  • 38.8k
64 votes
153 answers

Draw an asterisk triangle

Inspired by a task for Programming 101, here's a challenge that hopefully isn't too easy (or a duplicate). Input: A positive integer n >= 1. Output: ...
Sickboy's user avatar
  • 1,205
81 votes
94 answers

Golf all the 16 logic gates with 2 inputs and 1 output!

For example, the gate A and B is a logic gate with 2 inputs and 1 output. There are exactly 16 of them, because: each logic gate takes two inputs, which can be ...
Leaky Nun's user avatar
  • 49.8k
73 votes
84 answers

No strings (or numbers) attached

If you like this, consider participating in: The Official Dyalog APL 2016 Year Game The monthly Dyalog APL 2017 Code Golf Challenge Make 12 snippets/expressions, in the same language, that result in ...
Adám's user avatar
  • 30.4k
78 votes
68 answers

Shortest program that throws StackOverflow Error [closed]

Write a program that throws a StackOverflow Error or the equivalent in the language used. For example, in java, the program should throw java.lang.StackOverflowError...
True Soft's user avatar
  • 1,095
137 votes
29 answers

Making Future Posts Runnable Online with Stack Snippets [closed]

Stack Snippets were recently added to PPCG! Reminiscent of JSFiddle, Stack Snippets allow HTML, CSS, and JavaScript to be run directly in posts! Here is a very simple Stack Snippet: ...
Calvin's Hobbies's user avatar
47 votes
79 answers

Is it a leap year?

This challenge is quite simple. You will take an input which will be a year from 1801 to 2400, and output if it is a leap year or not. Your input will have no newlines or trailing spaces: ...
user avatar
41 votes
67 answers

Play a sound, any sound [closed]

Your program has to make the computer produce a sound, any sound. Shortest code wins, not sooner than 10 days after the first valid answer. If there is a tie, the one submitted sooner, wins. The ...
vsz's user avatar
  • 8,109
49 votes
67 answers

Depalindromize this string!

Given a palindrome generated according to this challenge, depalindromize it. Test cases ...
Oliver Ni's user avatar
  • 10.6k
31 votes
54 answers

The Smart Person's Mirage

Once upon a time, I was reading this question/answer on Quora Are there really programmers with computer science degrees who cannot pass the FizzBuzz test This code is given as the obvious answer <...
gnibbler's user avatar
  • 15.1k
88 votes
28 answers

Bake a slice of Pi

Write a program or function that prints or outputs this exact text (consisting of 142 characters): ...
Copper's user avatar
  • 3,930
120 votes
19 answers

"Hello, World!" in zero lines of code

NPM's sloc is a moderately popular tool for counting source lines of code in a file. The tool will attempt to strip out both single and multiline comments and count the remaining lines in order to get ...
Sisyphus's user avatar
  • 14.8k
32 votes
77 answers

Count the number of ones in an unsigned 16-bit integer

Write some statement(s) which will count the number of ones in an unsigned sixteen-bit integer. For example, if the input is 1337, then the result is ...
ayane_m's user avatar
  • 1,019
30 votes
72 answers

A square of text

The Challenge Given a string, output the text in the shape of a square. You can assume that the text will always fit in a square, and that it will never be an empty string. You can also assume it ...
acrolith's user avatar
  • 3,928
50 votes
45 answers

Fake Marquee Text

In this challenge fake marquee text is text that is shown part by part, in a scrolling-like fashion. Some examples: ...
Caridorc's user avatar
  • 2,338
33 votes
52 answers

Split a list at the second occurrence of the first element

Why should you golf in Haskell? Find out here. In that answer, Zgarb defines a task: Let's define a function f that splits a list at the second occurrence of the ...
caird coinheringaahin g's user avatar
29 votes
69 answers

Check whether an integer is a power of 2 without using +,- operations [closed]

Write a program that checks if the integer is a power of 2. Sample input: 8 Sample output: Yes Sample input: ...
gthacoder's user avatar
  • 1,065
58 votes
25 answers

Tips for golfing in Jelly

Jelly is a tacit, golf-oriented programming language by our very own Dennis. It’s popping up in answers here more and more often, beating other golf-y languages like Pyth and CJam, both by using its ...
lynn's user avatar
  • 68.8k
97 votes
15 answers

Create a programming language that only appears to be unusable

Robbers' challenge thread is here. Cops' challenge: Design a programming language that appears to be unusable for programming, but admits computation (or at least completion of the task) through some ...
feersum's user avatar
  • 31.4k
47 votes
35 answers

XOR multiplication

You goal is to implement the operation of XOR (carryless) multiplication, defined below, in as few bytes as possible. If we think of bitwise XOR (^) as binary ...
xnor's user avatar
  • 145k
53 votes
31 answers

Generate a mandelbrot fractal [closed]

Your task is to draw the mandelbrot set in ascii. It should look something like The complex number c lies in the mandelbrot set, when the sequence ...
Hannesh's user avatar
  • 1,225
61 votes
25 answers

Print This Question ↓

The basic idea of a kolmogorov-complexity challenge is to print a set output in the shortest code (though that meaning has changed now). We have had many of them, from Borromean Rings to The ...
Maltysen's user avatar
  • 25.7k
47 votes
28 answers

Remove every N-th N

The task In this challenge, your input is a non-empty list of positive integers, given in the native format of your language. Your output is that same list, in the same format, with some elements ...
Zgarb's user avatar
  • 42.7k
26 votes
51 answers

Draw an alphabet party hat

Your task is to print this exact text: ...
Oliver Ni's user avatar
  • 10.6k
49 votes
19 answers

Tips for golfing in The Shakespeare Programming Language

What general tips do you have for golfing in The Shakespeare Programming Language? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to SPL ...
xenia's user avatar
  • 8,142
28 votes
29 answers

Let's do the Wave!

Input: A string (the wave-snippet) with a length >= 2. A positive integer n >= 1. Output: We output a single-line wave. ...
Kevin Cruijssen's user avatar
46 votes
15 answers

Tips for Creating/Maintaining a Golfing Language

Creating a golfing language can be hard. Let's help budding golfing language creators out and provide some helpful tips on how to create one. I'm looking for tips on: The design process ...
lyxal's user avatar
  • 33.6k
4 votes
89 answers

Summation from a to b

The program has an input of a and b, and outputs the sum of numbers from a to b, inclusive. Score is in bytes. As always, standard loopholes are disallowed. If your input is in the format [a,b], +3 ...
user avatar
27 votes
19 answers

Shortest Sorted Hello World

Write a program that takes no input and prints Hello, World! to stdout or your language's closest alternative. The catch is that each line in your program must only ...
Calvin's Hobbies's user avatar
31 votes
27 answers

Palindromizing the strings

Introduction For the ones who don't know, a palindrome is when a string is equal to the string backwards (with exception to interpunction, spaces, etc.). An example of a palindrome is: ...
Adnan's user avatar
  • 44.4k

15 30 50 per page