Questions tagged [kolmogorov-complexity]

Kolmogorov complexity, informally, is the amount of code it takes to describe or produce a constant object, such as a string or image. When posting a challenge in this category, please make sure it adds something new to existing challenges.

Filter by
Sorted by
Tagged with
16
votes
10answers
554 views

Quickly! Group together!

This challenge will function somewhat like an answer-chaining question, in that new answers will (somewhat) depend on old answers. However, this is (as far as I can tell) a unique form of answer-...
96
votes
307answers
24k views

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 learned when I started learning programming ~10 years ago. Task You are to print this ...
37
votes
20answers
7k views

Print the SARS-Cov-2 (COVID-19) genome

Background As you probably learned in biology class, DNA and RNA are composed of strands of nucleotides; each nucleotide consists of a chemical called a base together with a sugar and a phosphate ...
71
votes
148answers
17k views

The alphabet in programming languages

Our task is to, for each letter of the (English) alphabet, write a program that prints the alphabet, in a language whose name starts with that letter. Input: none Output: ...
19
votes
10answers
2k views

Code a code page

Introduction A code page maps integer values to a specific character. We can visualize a code page like this: +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | | 0 | 1 | 2 | 3 ...
454
votes
806answers
145k views

“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 ...
44
votes
87answers
11k views

Draw an ASCII chess board!

Here is a simple challenge for you: You must produce this ASCII representation of a chess board. White is represented by uppercase characters, and black is represented by lowercase. Empty tiles are ...
10
votes
10answers
1k views

Encode an image inside of the source

The golf challenge is to encode and compress the following image inside a source file. To do this you need to write 3 functions: red, ...
57
votes
106answers
13k views

List of primes under a million

This is my first code golf question, and a very simple one at that, so I apologise in advance if I may have broken any community guidelines. The task is to print out, in ascending order, all of the ...
76
votes
88answers
17k views

Build me a brick wall!

Challenge I need help building a brick wall! Throw together some code for me using no input and produce the following output wall shown below: ...
37
votes
13answers
5k views

Picture of an old friend in ASCII art

I hope this picture looks familiar to you. It's one of Pacman's ghosts in his "vulnerable" state, after Pacman has eaten a power pill. The challenge Picture our ghost in a little frame, using ASCII ...
45
votes
78answers
13k views

Hack into a Lottery

You've recently made an account on a dodgy gambling site, where for a fee of 25 dollars, they will pay you back a random amount between 0 and 50 dollars. After getting around 5 dollars twice, you ...
164
votes
300answers
49k views

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 ...
33
votes
11answers
2k views

What song is playing?

Inspired by this xkcd You work for Shazam and they have a project for you. Some customers are complaining about their app taking up too much space on their phone, so they want you to code a lite ...
13
votes
25answers
2k views

Calculate golden ratio

Write the shortest code, in number of bytes, to display, return, or evaluate to the golden ratio (that is, the positive root of the quadratic equation: \$x^2-x-1=0\$, approximately 1.618033988749895), ...
34
votes
11answers
12k views

Brainf*** Golfer

One of easiest code written by a programming language is a program printing sequence of characters (ex. "Hello, world!"). However, some esoteric programming languages like Brainfuck, even this ...
30
votes
89answers
4k views

Generate alphabet with 4 copies of each letter

Note that this is not the same as Print the alphabet four times. This task is to write a program to generate four copies of each letter of the English alphabet, one letter per line, on standard ...
67
votes
117answers
8k views

Print/Output the L-phabet

Inspired by George Gibson's Print a Tabula Recta. You are to print/output this exact text: ...
27
votes
82answers
13k views

Print a Christmas Tree

The Challenge Print a nice Christmas tree with it's own star at the top using the shortest code possible. The tree star is an asterisk (*) and the tree body is ...
52
votes
50answers
7k views

Print all ASCII alphanumeric characters without using them

Challenge Print the following characters: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 The catch is that you may not use any one of them in ...
41
votes
15answers
6k views

Let's draw Mona Lisa

In 2014, demoscener Jakub 'Ilmenit' Debski released a 250-byte(1) procedural graphics demo for the Atari XL called Mona. It's drawing the following picture(2): Your task is to generate the exact same ...
60
votes
11answers
4k views

ASCII Train Golf

Consider these seven ASCII train cars. Engine (E) __ ====== \/ | [] |========= | ) ================ O-O-O O-O-O \\ Passenger ...
17
votes
5answers
2k views

Convert Magic the Gathering colours to a Colour based deck name

Magic the gathering has many unique names for colour combinations in decks, as an example when Blue and White appear together in a deck, the deck maye sometimes be named after the Ravnican Guild that ...
13
votes
5answers
731 views

Write a Unicode Unpacker

We all know scoring by characters is ripe for abuse. Let's prove this. The Challenge Output the following: ...
22
votes
12answers
2k views

Print a Ternary Value

Put simply, you are to print out the following number: ...
43
votes
18answers
10k views

Duck, duck, gone!

Here is the (quite scary) Five little ducks song(it is not long): ...
263
votes
64answers
73k views

We're no strangers to code golf, you know the rules, and so do I

Write the shortest program that prints the entire lyrics of "Never Gonna Give You Up" by Rick Astley. Rules: Must output the lyrics exactly as they appear in the above pastebin*. Here's the raw dump:...
17
votes
6answers
2k views

Golf me an ASCII Alphabet

Don't you find that reading simple text isn't appealing enough? Try our ...
25
votes
16answers
4k views

Given the names of two planets, give the distance

Using the following table (source) write some code that takes the names of two planets and returns the distance between them: ...
40
votes
45answers
6k views

Every word from babab to zyzyz

Your task is to write a program that will output a readable list of every five letter words with the structure: consonant - vowel - consonant - vowel - consonant The output should be sorted ...
40
votes
23answers
3k views

Output the Trinity Hall Prime

Based on this Math.SE question; number copied from this answer. Number originally from a Numberphile video, of course. Your task is to output the following 1350-digit prime number: ...
9
votes
7answers
2k views

Generating BF-code with single purpose

I'd like to see you create code (in any programming language) that output working BF (Brain***k) code. Your program have a single character input on stdin. The input should be one digit ("0", "1", "2",...
38
votes
5answers
2k views

Find me a Tinder date!

Ah, Tinder . . . the app that takes the code golf approach to online dating. With just a few well-chosen right swipes and a bit of luck (or a cute puppy pic), you too could have more matches than /(?!)...
-1
votes
16answers
484 views

Implement Smokey's !!/coffee command. (Part 2)

Like the previous SmokeDetector challenge? This one is for you too ;) Note: SmokeDetector is a bot that detects spam and offensive posts on the network and posts alerts to chat. What to implement ...
24
votes
49answers
2k views

Draw an alphabet party hat

Your task is to print this exact text: ...
69
votes
106answers
8k views

Make an alphabet searchlight!

Inspired by a bug in a solution to this challenge, your challenge is to produce this exact text: ...
31
votes
97answers
5k views

Alphabet Staircase

The Challenge Your task is to create a program or function that outputs the following with no input: ...
42
votes
77answers
4k views

A very long Terza Rima

Description Output the rhyme scheme for a very long Terza Rima. Input None. Output ...
6
votes
10answers
466 views

Print the alphabet Christmas tree [duplicate]

I know it's 1.5 weeks after Christmas but trying to print an isosceles triangle in a monospaced font makes it look weird. Challenge Print the alphabet from A to Z so that it forms a filled triangle ...
15
votes
10answers
1k views

Output the International Phonetic Alphabet

The International Phonetic Alphabet is a system of phonetic notation intended to be able to accurately represent every sound used in spoken language. The alphabet contains 29 vowel letters ...
46
votes
139answers
14k views

Output programming language name

Challenge: In the programming language of your choice, take no input and output your programming language's name. Fair enough, right? Restrictions: You can't use any character that is included in ...
24
votes
10answers
3k views

The Saltine Challenge

Here is an ASCII saltine cracker: ...
52
votes
91answers
9k views

Print X without X (cop's thread)

This is the cop's thread of a cops-and-robbers challenge. You can view the robber's thread here A pretty common beginner style question is to print some string, but, there's a catch!, you need to do ...
31
votes
85answers
8k views

Print X without X (robber's thread)

This is the robber's thread of a cops-and-robbers challenge. You can view the cop's thread here A pretty common beginner style question is to print some string, but, there's a catch!, you need to do ...
21
votes
13answers
3k views

Peel away the layers - Cops

In this cops-and-robbers challenge, robbers must crack cop answers by finding out which languages the cops used. This is the Cops thread. For the Robbers' challenge, see here Cops, you are to write a ...
54
votes
31answers
11k views

Print the phrase “And she said, 'But that's his.'” using only the alphabet

Print the phrase And she said, 'But that's his.' using only the following characters: ...
9
votes
9answers
733 views

Electoral votes from state name

Given a the name of a state of the United States as a string (with case), return the number of votes the state has in the Electoral College. Write a full program or function, and take input and output ...
113
votes
46answers
13k views

It's my Birthday :D

Introduction Last year was my birthday (really!) and sadly I had to organise my own party. Well, now you know, couldn't you at least make the cake? Challenge Given an integer ...
25
votes
26answers
5k views

Output a Sudoku board

Today's challenge is simple: Without taking any input, output any valid sudoku board. In case you are unfamiliar with sudoku, Wikipedia describes what a valid board should look like: The objective ...
84
votes
26answers
7k views

Bake a slice of Pi

Write a program or function that prints or outputs this exact text (consisting of 142 characters): ...

1
2 3 4 5
13