Kolmogorov complexity, informally, is the amount of code it takes to produce a given string of text. When posting a challenge in this category, please make sure it adds something new to the challenges that already exist.

learn more… | top users | synonyms

11
votes
31answers
3k views

Go generate some Java

Your boss wants you to write code like this: public static boolean isPowerOfTen(long input) { return input == 1L || input == 10L || input == 100L || input == 1000L || input == 10000L ...
23
votes
45answers
3k views

Generate 100 Java Tuple classes

Write a script that writes to standard output, or your language's equivalent, 100 lines of (valid) Java code that begins with: class Tuple1 {public Object _0;} class Tuple2 {public Object _0,_1;} ...
9
votes
2answers
171 views

Output all valid classful public unicast IPv4 addresses

IPv4 addresses are 32 bits wide, and thus the size of the address space is 232, or 4,294,967,296. However, this is only a theoretical upper-bound. It is not an accurate representation of all the ...
11
votes
4answers
245 views

Strategies for representing a given large integer using arithmetic expression

I have a specific number in mind, but it's part of a challenge I'm doing, and I don't want people to do (all) the work for me. Here is a number which has the same digits, but shuffled: ...
11
votes
12answers
2k views

Eeny, meeny, miny, moe

Introduction The childhood song Eeny, meeny, miny, moe was often used to select who was "it" when playing tag. Everyone would stand in a circle and point at one person selected at random. They ...
5
votes
1answer
109 views

Encode bytes to PGP wordlist format

The PGP Word List is a set of 512 English words for verbally communicating strings of bytes, such as authentication codes or hashes. It is used in secure VoIP software as well as in some other ...
5
votes
2answers
162 views

Build an English word syllable counter

Write a program or function to estimate as closely as possible the number of syllables in English words. The input list is here: 1000 basic English words. There are only 997 words because a few ...
22
votes
13answers
2k views

Create an ASCII-to-hex table for Mark Watney

Inspired by this SciFi.SE question. Background (with minor spoiler): Challenge With no input, output the following ASCII table exactly like this: Dec Hex Dec Hex Dec Hex Dec Hex Dec ...
8
votes
14answers
405 views

Chinese Zodiac of the year

2015 was the year of the goat! In this challenge, you will figure out which animal represents the year. To avoid making this challenge to complex you won't need to calculate Chinese new year. Because ...
5
votes
6answers
216 views

Using Symbols for Letters

Input: A single word as a string (matches [a-zA-Z]+). If the input doesn't follow these guidelines, print "Error" (but no error should be thrown) Output: The NATO pronunciation of the word. Print ...
25
votes
6answers
377 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 ...
1
vote
0answers
48 views

Merry Christmas (and a Happy New Year) [duplicate]

The goal of this challenge is to create a program that outputs a string depending on the time of year. Output If the date is December 25, output: Merry Christmas! If the date is December 31 or ...
41
votes
12answers
5k views

Help Trump build the wall!

Trump needs the wall constructed and you are going to do it! To most efficiently build his wall I have created a simple, repeatable pattern for you to use: __ __ | |_| | ___| ...
16
votes
2answers
308 views

Forgotten Realms date calculator

In an effort to level the playing field between languages with built-in date libraries and those without, let's work with a fictional calendar. The Forgotten Realms are a (the?) campaign setting for ...
23
votes
15answers
1k views

A multiplication table for the Cheela

The Cheela (from the book Dragon's Egg by Robert L. Forward) are creatures that live on the surface of a neutron star. Their body is flat and circular with twelve eyes on the perimeter, so they ...
29
votes
6answers
1k views

Unfolding the Hexagony source code

Introduction If you're not familiar with Hexagony, it's an esoteric language created by Martin Büttner. The thing is that this language accepts multiple forms for the program. The following programs ...
18
votes
5answers
337 views

8-bit Chess Pixel Counting

Goal You're playing a computerised chess game. The display is in black and white only and the pixels are chunky. White pixels use a lot power compared to black pixels and you're concerned about ...
23
votes
8answers
493 views

The alphanumeric spiral

The task is very simple, when given an input, output one of the following spirals: Input = 1 gives a spiral with the letter A beginning in the top left corner: A B C D E F T U V W X G S 5 6 7 Y H R ...
22
votes
8answers
1k views

Basic Latin character name to character

Let's get back to basics! Your code, a complete program or function, must convert the official Unicode name of a printable Basic Latin character into the corresponding character. For example, for ...
15
votes
5answers
303 views

Can't see the forest for the keys

Write a program or function that takes in a nonempty list of integers in any reasonable convenient format such as 4, 0, -1, -6, 2 or [4 0 -1 -6 2]. Print or return a string that depicts the list as ...
5
votes
5answers
362 views

Find that zipcode!

Italian zipcodes are 5-digit numbers. Each number is linked to a province. There are 4610 zipcodes and 110 provinces (as of 2015) in Italy. Given the list of zipcodes and the related province (in ...
0
votes
3answers
132 views

Guess my password! (Code Golf) [duplicate]

So, like the title says, today you are going to guess my password (sort of). You need to make a big long list of every possible password I might be using on my 4 digit online vault. Specifications: ...
18
votes
17answers
2k views

States and Capitals

Given a string as input, output the US state whose capital it is if it is a state capital, the capital of the state if it is a state, or Arstotzka if it is neither. Examples: Austin -> Texas ...
43
votes
80answers
8k views

“99 Bottles of Beer”

Write a program that outputs the lyrics to 99 Bottles of Beer, in as few bytes as possible. Lyrics: 99 bottles of beer on the wall, 99 bottles of beer. Take one down and pass it around, 98 bottles ...
20
votes
1answer
514 views

The Death Of Low-Resolution Pixel Art (Or, Draw That Death)

This is an Irregular Webcomic! themed task.* Death is a rather extensive orginization, and, although Head Death has had no trouble telling his employees apart, certain other entities connected to ...
19
votes
5answers
596 views

String to ASCII Art Text

The Task You are to write some ASCII Art Text as seen from this website for generating ASCII art! Rules Input will only be alphabetical text and spaces, and will be input as a single line. It is ...
28
votes
9answers
1k views

Play “Taps”​​​​

Today, November 11, 2015, is Veterans Day in the United States. "Taps" is the bugle call played at U.S. military funerals: ("Taps" on SoundCloud from vtmiller) It is a ...
16
votes
7answers
754 views

Print a Pentomino Rectangle

Write a program or function that takes no input but prints or returns a constant textual depiction of a rectangle made of the 12 distinct pentominoes: The rectangle may have any dimensions and be ...
55
votes
35answers
8k views

Fibonacci + Fizz Buzz = Fibo Nacci!

Fibonacci + FizzBuzz = Fibo Nacci! Your challenge is to create a Fibo Nacci program! A Fibo Nacci program outputs the first 100 Fibonacci numbers (starting from 1). If the Fibonacci number is ...
6
votes
9answers
612 views

What am I even saying?

You're playing TF2, and you want to make a bot that will just put voice commands into the chat box. Typically, to "call" a voice command, one would press a key (Z, X, or C) and a number (1-8) to ...
-5
votes
5answers
221 views

Print the lyrics to Caius' Theme (Final Fantasy XIII-2) [duplicate]

Print or return these lyrics: Dea Mortis, iuravi Carissimam servaturum. Dea Mortis, servabo Ut tempora recte ducam. Etsi cor in Chaos, Aut Fortuna bella ferat, Occurram et obviam ibo. The line ...
9
votes
2answers
243 views

Shortest ><> numbers

When golfing in ><>, having short numbers is very important. Now write some code. The program should input an integer, and output the shortest ><> representation. For the non-><> users, ...
23
votes
16answers
3k views

Print the Capitals without the Capitals

Whoa, whoa, whoa ... stop typing your program. No, I don't mean "print ABC...." I'm talking the capitals of the United States. Specifically, print all the city/state combinations given in the ...
38
votes
27answers
3k views

Element names above 118

IUPAC in their insufferable wisdom have created a systematic element name for any newly created element. This is the temporary name of an element until they finally make up their minds about an actual ...
38
votes
18answers
4k views

Print out all IPv6 addresses

This reminds me when a few years ago someone uploaded a torrent "Hacker tool: complete list of all IP addresses". This was, of course, just a generated list of the ~4 billion IPv4 addresses, but ...
18
votes
2answers
568 views

Golfing Strings

I have always failed to give an answer for kolmogorov-complexity challenges which require string compression, the main reason being that I don't know to use string compression tools as effectively as ...
45
votes
11answers
5k views

Just repeat yourself

Write a program that outputs Do not repeat yourself! Your program code must respect the following constraints : its length must be an even number each character that is in position 2n (where n ...
4
votes
2answers
273 views

The Stack Exchange Site List [duplicate]

Currently, the Stack Exchange network has nearly 150 sites. These sites are as follows: Computer Graphics Portuguese Language elementary OS Open Source Law Русский язык Mythology Health Stack ...
19
votes
6answers
2k views

Draw a Houndstooth Pattern

Write a program or function that takes in two positive integers, a width and a height, and draws an ASCII art houndstooth grid pattern with those dimensions using this 25×26 text grid as the ...
18
votes
10answers
746 views

Work it harder, make it better

In this challenge your goal will be to output the lyrics to Daft Punk's Harder, Better, Faster, Stronger. Specifically, output this text: Work It Make It Do It Makes Us Harder Better Faster ...
14
votes
4answers
908 views

The Lazy Programmer's XML Parser

Background You are working as a programmer for a car sales company. Your task for this week is to program an XML parser that takes in data about available models from different car manufacturers, and ...
95
votes
39answers
11k views

It's my Birthday :D

Introduction Yesterday 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 n as input, write a ...
33
votes
16answers
2k views

Print the character names

Every Unicode character has a name, like "LATIN CAPITAL LETTER A". A Unicode character name may contain only uppercase letters, white spaces, and the minus sign. Write a program that reads a text and ...
29
votes
11answers
1k views

Cardinals and ordinals, 1 to 100

Here's a simple one to stretch your compression muscles. Your code (a complete program) must output the spelled-out English representation of all the cardinal numbers from 1 to 100, and then all the ...
9
votes
7answers
2k views

Have you mooed today?

The Debian Linux distribution (and Debian-based distros, like Ubuntu, Kali and others) uses a package-manager called APT. To install program foo you would type into a terminal sudo apt-get install ...
35
votes
12answers
3k views

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 ...
158
votes
370answers
27k 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 ...
16
votes
5answers
934 views

Fibonacci in +!()[]script

Write a piece of JavaScript code that calls alert with an array containing the first 50 Fibonacci numbers in order. You may only use the following characters: +!()[]. As a reference, your code must ...
8
votes
3answers
644 views

ASCII Art Chessboard

In this challenge, you are to draw the chessboard below, and allow for moves to be made. 1. Drawing Each white square has 5x9 spaces. Each black square has 5x9 colons. The board is surrounded by a ...
16
votes
9answers
787 views

Convert a Point of the Compass to Degrees

I came up with this challenge independently, but it turns out to be the inverse to this challenge by Doorknob. As I really like his spec, I decided to steal large parts of it instead of cooking up my ...