Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Code challenges of all types. For questions about golfing, bowling, etc, use Q&A. For questions about this community, use Meta. To get feedback on a challenge before posting it, use Sandbox.

Filters (None)
80%
+6 −0
Cod golf: condense your shoal

Your answer is a string containing 255 fishes as subsequences, and your score is the length of that string in bytes (lowest score wins). Rules Your string must include at least 255 fishes from ...

3 answers  ·  posted 6mo ago by trichoplax‭  ·  last activity 6mo ago by Moshi‭

string lowest-score
50%
+0 −0
Circle of text characters

Given a radius R, output a text representation of a circle. Input A positive integer R (strictly greater than zero) You do not need to handle values of R greater than 32 Output A square ...

1 answer  ·  posted 4y ago by trichoplax‭  ·  last activity 6mo ago by jhnc‭

code-golf string
71%
+3 −0
Pinwheel ​words

Given a word that can be rotated by 180 degrees (a half turn) about at least one of its 3 axes and continue to be composed of English alphabet letters, output one of its rotated forms. The 3 rotat...

1 answer  ·  posted 4y ago by trichoplax‭  ·  last activity 6mo ago by jhnc‭

code-golf alphabet
60%
+1 −0
Most isolated of 3 points

Given 3 points, output one that is separated from its nearest neighbour by the largest distance. Input 3 distinct points (that is, no 2 points are in the same position). Each point is a pair o...

1 answer  ·  posted 2y ago by trichoplax‭  ·  last activity 6mo ago by jhnc‭

code-golf math number
60%
+1 −0
Digit balanced numbers

Does a number have balanced numbers of distinct digits? That is, do the number's digits appear with equal frequency? Input A positive integer N. N will have no leading zeroes. Output An ...

6 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 6mo ago by ojdo‭

code-golf number
66%
+2 −0
How many odd digits?

Given a positive integer, count its odd digits. Input An integer from 1 to 999,999,999, inclusive, in any of the following formats: A number (such as an integer or floating point number), li...

8 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 6mo ago by ojdo‭

code-golf number
88%
+13 −0
Cumulative Counts

Challenge Given an array of numbers return the cumulative count of each item. This is the number of times an item has occurred so far. Examples [1,1,2,2,2,1,1,1,3,3] -> [1,2,1,2,3,3,4,5,1,2]...

23 answers  ·  posted 5y ago by rak1507‭  ·  last activity 6mo ago by jhnc‭

code-golf
62%
+3 −1
Convert to Hexadecimal

Challenge Write a program that takes in a number greater than or equal to 0 and outputs its representation in hexadecimal (base 16). Examples 0 => 0 1 => 1 10 => A 15 ...

7 answers  ·  posted 1y ago by CrSb0001‭  ·  last activity 8mo ago by Glory2Ukraine‭

code-golf math base hexadecimal
57%
+2 −1
Fast sampling of special binary strings

We are going to define a simple little language. A word in this language is a binary string where the longest run of consecutive $0$s, is shorter than every run of $1$s which is not contained withi...

0 answers  ·  posted 10mo ago by WheatWizard‭  ·  edited 10mo ago by WheatWizard‭

code-golf random restricted-complexity
33%
+0 −2
Partition Algorithm Trap

Challenge Find a valid input (multiset of positive integers) for this deterministic $O(n^2)$ Partition algorithm such that: The algorithm fails to find a solution even though one exists, or The...

0 answers  ·  posted 12mo ago by KaoruAK‭  ·  edited 10mo ago by WheatWizard‭

code-challenge
66%
+2 −0
Is it part of the mandelbrot set?

Input is a number, you have to decide if it is part of the mandelbrot set or not, after at least 16 iterations. This is done by applying this formula: $z_n = z_{n-1}^2 + c$ repeatedly. $c$ is the ...

2 answers  ·  posted 3y ago by H_H‭  ·  last activity 1y ago by Arpad Horvath‭

code-golf
84%
+9 −0
Bytes to Segfault

Challenge Cause the currently running program to receive the SIGSEGV signal (on Linux or other *nix systems) as fast as possible. What it does with the signal doesn't matter as long as it receives...

12 answers  ·  posted 6y ago by moony‭  ·  last activity 1y ago by mvirts‭

code-golf *nix
66%
+4 −1
Print the modular multiplicative inverse / virtual fractions

Goal Print the modular multiplicative inverse with a modulus of 65536 (or a higher exponent of 2) for odd numbers 1-97. Example output Print these values (or an extension of them): 1 43691 52...

3 answers  ·  posted 2y ago by H_H‭  ·  edited 1y ago by deleted user

code-golf math
83%
+8 −0
Integer to Roman numeral

The task is to take a decimal integer as input and print the corresponding Roman numeral with capital letters. The program must handle all positive integer numbers between 1 and 1000. Input can be...

5 answers  ·  posted 6y ago by Lundin‭  ·  last activity 1y ago by CrSb0001‭

code-golf
75%
+4 −0
Calculate a person's age

Challenge Given a date with day, month and year, calculate how old a person born on that day would be today. Input can be in any reasonable format (params, array, date object). Input will never ...

0 answers  ·  posted 5y ago by Razetime‭  ·  edited 1y ago by deleted user

code-golf date
57%
+2 −1
Show order equivalence between the rationals and the binary fractions

Write a function $f$ which takes rational numbers and gives binary fractions (rational numbers whose denominator is a power of two) which is bijective and preserves order. That means: Different...

0 answers  ·  posted 1y ago by WheatWizard‭  ·  edited 1y ago by WheatWizard‭

code-golf math open-ended-function
83%
+8 −0
Compute the determinant

Challenge A simple challenge: Given a two-dimensional matrix (an array of arrays) of real numbers, compute the determinant. The determinant of a matrix is a mathematical construct used in many ap...

10 answers  ·  posted 5y ago by Moshi‭  ·  last activity 1y ago by CrSb0001‭

code-golf math
50%
+0 −0
Awkward Ordinals

Write code that takes a positive integer and outputs the awkward ordinal name from the test cases. Notice that these are not the conventional ordinal names. Input A positive integer from the te...

0 answers  ·  posted 1y ago by trichoplax‭  ·  edited 1y ago by trichoplax‭

code-golf number string
75%
+4 −0
Caesar shift cipher

Introduction What is the Caesar shift cipher (ROT$n$)? It's basically a cipher sequence that changes a letter's value from the number chosen. If we use ROT1 on "games", we get "hbnft". The basic i...

9 answers  ·  posted 5y ago by General Sebast1an‭  ·  last activity 1y ago by CrSb0001‭

code-golf string sequence encryption decryption
71%
+3 −0
Prove commutativity on this monoid presentation.

Given two binary strings $A$ and $B$ such that $A$ is an anagram of $B$, output a third binary string $S$ such that both $A$ and $B$ can be created by iterated removals of the substring $10101$ fro...

2 answers  ·  posted 3y ago by WheatWizard‭  ·  last activity 1y ago by m90‭

code-golf abstract-algebra
60%
+4 −2
"Hello, {name}!"

Background While we do have a "Hello, World!" challenge, we still don't have one regarding input. So let's do one! Challenge Create a program that takes an input (not as a function argument) the...

17 answers  ·  posted 5y ago by General Sebast1an‭  ·  last activity 1y ago by CrSb0001‭

code-golf string
75%
+4 −0
Expand a polynomial

Challenge Given the roots of a polynomial (that is, the $x$ values where the polynomial evaluates to zero), as an array of real numbers, return the polynomial's coefficients. That is, given real ...

5 answers  ·  posted 5y ago by Moshi‭  ·  last activity 1y ago by panadestein‭

code-golf math
60%
+1 −0
Find all unique quintuplets in an array that sum to a given target

Inspiration: Leetcode's [3Sum] linkLink on CG&CC Problem Given an array nums of n (not necessarily distinct) integers, and given a target number target, return an array of all of the unique...

2 answers  ·  posted 2y ago by CrSb0001‭  ·  last activity 1y ago by panadestein‭

code-golf array arithmetic
88%
+13 −0
Partial Sums of Harmonic Series

Given an positive integer $n$, return the least positive integer $k$ such that the $k$th partial sum of the harmonic series is greater than or equal to $n$. For example, if $n = 2$, then $k = 4$, b...

13 answers  ·  posted 6y ago by Quintec‭  ·  last activity 1y ago by panadestein‭

code-golf
80%
+6 −0
Display a Progress Bar

The goal of this challenge is simple: given a ratio of whole numbers, output a 50-character long progress bar representing the ratio. Rules Input Your program must take two numbers as input. T...

7 answers  ·  posted 2y ago by Sylvester‭  ·  last activity 1y ago by panadestein‭

code-golf
71%
+3 −0
Borromean coprimes

Given 3 positive integers, indicate whether they are Borromean coprimes. Definition 3 positive integers are called Borromean coprimes if both of the following are true: Their greatest common d...

5 answers  ·  posted 3y ago by trichoplax‭  ·  last activity 1y ago by panadestein‭

code-golf math
60%
+1 −0
Abstract Rewriting Systems (Cops)

This is somewhat of a [proof-golf]-like [cops-and-robbers]. This is the cops' thread; the robbers' thread is here Sections: Cops Scoring What is a rewrite rule? An example An example of...

1 answer  ·  posted 2y ago by CrSb0001‭  ·  last activity 2y ago by CrSb0001‭

cops-and-robbers repeated-transformations grammars
80%
+6 −0
Find the IP address class

Task Given an IP address as a string, find its IP address class. For reference, here is a table: Class Leadingbits Numberof networks Addressesper network Total addressesin class Start...

8 answers  ·  posted 5y ago by Razetime‭  ·  last activity 2y ago by Lundin‭

code-golf
64%
+7 −3
Make $2 + 2 = 5$

In this challenge, add 2 integers, but if both the integers are 2, output 5. Shortest code in each language wins! Example ungolfed program in Python 3.x def add(x, y): if x == 2 and y == 2: ...

23 answers  ·  posted 5y ago by General Sebast1an‭  ·  last activity 2y ago by arutonee‭

code-golf math number
50%
+0 −0
Abstract Rewriting Systems (Robbers)

This is somewhat of a [proof-golf]-like [cops-and-robbers]. This is the robbers' thread; the cops' thread can be found here. Sections: Robbers Determining a winner Robbers The cops wil...

0 answers  ·  posted 2y ago by CrSb0001‭  ·  edited 2y ago by CrSb0001‭

cops-and-robbers repeated-transformations grammars
75%
+4 −0
Source with the whole alphabet in order of appearance

The challenge is to write as short a source as possible, where the English alphabet (in alphabetical order from top to bottom) "abcdefghijklmnopqrstuvwxyz" is a sub-sequence of the source code. Th...

5 answers  ·  posted 2y ago by Lundin‭  ·  last activity 2y ago by Sylvester‭

code-golf
50%
+0 −0
Multiplicative perfection

Given a positive integer, indicate whether it is the product of its proper divisors. Integers equal to the product of their proper divisors can be found on the Online Encyclopedia of Integer Seque...

4 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 2y ago by celtschk‭

code-golf math number decision-problem
60%
+1 −0
Hex ​​​detector

Given an integer from 1 to 1000, indicate whether it is a centered hexagonal number[1] (also known as a hex number). What is a hex number? The hex numbers can be visualised as follows: On a he...

4 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 2y ago by trichoplax‭

code-golf math number
85%
+10 −0
Looping counter

Looping counter Create an infinite loop that outputs lines of asterisks, with each line containing one more asterisk. Instead of the asterisk, any printable, non-whitespace character can be used. ...

21 answers  ·  posted 4y ago by celtschk‭  ·  last activity 2y ago by xrs‭

code-golf
66%
+2 −0
Substring factor

Does a positive integer have a substring as a factor? Input A positive integer. Output One of 2 distinct values to indicate whether the input has a factor that is a strict substring of it...

3 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 2y ago by Shaggy‭

code-golf math number string
71%
+3 −0
Towers of DC .:.

DC is a reverse-Polish calculator REPL that is available on most Linux distributions. In reverse-Polish notation, you can push values to a stack and then pop those values back off to perform operat...

0 answers  ·  posted 2y ago by Andrew Ray‭  ·  edited 2y ago by trichoplax‭

code-golf alternative-scoring
75%
+4 −0
Fibonascii Squares

The Challenge Your job is to, given input positive non-zero integer $n$, output an ASCII representation of the tiled Fibonacci squares up to the $n$th number of the Fibonacci sequence. Rules Inp...

2 answers  ·  posted 2y ago by Sylvester‭  ·  edited 2y ago by Sylvester‭

code-golf ascii-art fibonacci
60%
+1 −0
Rationalise recurring binary

Given a potentially recurring binary string, output the number it represents, as a fraction in lowest terms. The notation used in this challenge for recurring digits is non-standard. An r is used ...

0 answers  ·  posted 4y ago by trichoplax‭  ·  edited 2y ago by trichoplax‭

code-golf math string parsing binary
77%
+5 −0
55 fruit salad: choose your own Kolmogorov complexity

This is a fixed output challenge. It is similar to a standard Kolmogorov complexity challenge, except you get to choose your own fixed output. Given no input, output 55 fruits. You may choose any 5...

5 answers  ·  posted 4y ago by trichoplax‭  ·  last activity 2y ago by trichoplax‭

code-golf kolmogorov-complexity string
80%
+6 −0
Digit Sum Integer Sequence (working title)

Inspired by this challenge. If anyone has any suggestions for a song title I could use for the challenge title then please leave a comment. Definition We define f(x) for a given integer as the su...

7 answers  ·  posted 5y ago by Shaggy‭  ·  last activity 2y ago by xrs‭

code-golf sequence
84%
+9 −0
1, 2, Fizz, 4, Buzz!

The task Output the first 100 elements of the infamous FizzBuzz sequence. How? The FizzBuzz sequence is the sequence of decimal integers from 1 to 100 inclusive, but: If the integer is divisi...

21 answers  ·  posted 6y ago by Dion‭  ·  last activity 2y ago by xrs‭

code-golf kolmogorov-complexity
86%
+11 −0
Reverse an ASCII string

Your goal is to reverse an ascii string. Given a (optionally newline or null terminated) input, output your input in reverse order, optionally followed by a newline. Terminate afterward. Function...

33 answers  ·  posted 6y ago by moony‭  ·  last activity 2y ago by xrs‭

code-golf
66%
+2 −0
Round trip stones

$N$ vessels initially contain $3$ stones each. What is the probability of having at least $3$ stones in the first vessel after moving a uniformly random selection from the first vessel to the secon...

1 answer  ·  posted 2y ago by trichoplax‭  ·  last activity 2y ago by Arpad Horvath‭

code-golf math number probability
66%
+2 −0
Construct the Irish possessive

In this challenge you will take an Irish word and a personal pronoun and create the possessive pronoun construction combining the two. For example sé, madra becomes a mhadra. Translated to English...

1 answer  ·  posted 2y ago by WheatWizard‭  ·  last activity 2y ago by Arpad Horvath‭

code-golf natural-language
60%
+1 −0
Word suggesting

Suggest a word from a word list, given a string. Motivation Imagine typing a word one letter at a time, and seeing a suggested word after each letter is typed. At first the suggested word is simp...

1 answer  ·  posted 3y ago by trichoplax‭  ·  edited 2y ago by trichoplax‭

code-golf string list
75%
+4 −0
12-hour time is weird

Your mission for today, should you choose to accept it, is to write a simple 12-hour clock calculator. Your input will always be in the form of arg op arg, where op is either + or -, and arg is eit...

0 answers  ·  posted 2y ago by honnza‭

code-golf
66%
+2 −0
Can I follow this recipe?

You work in a kitchen which has a peculiar rule. When you mix something into a pot you must always add at least one new ingredient. So you can add pasta, oil, salt then pesto, but not pasta, pesto...

1 answer  ·  posted 2y ago by WheatWizard‭  ·  last activity 2y ago by isaacg‭

code-golf decision-problem
71%
+3 −0
Plain black webpage

This is a language specific challenge, for HTML only. Your answer is the content of a self contained HTML file, that when opened in a web browser gives a plain black page. Requirements The HTM...

4 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 2y ago by Razetime‭

code-golf internet html
60%
+1 −0
Shortest representation in generalised Roman numerals

Find the shortest representation of an integer in generalised Roman numerals. Since there is more than one way to generalise, only the following definition applies to this challenge. Definition T...

1 answer  ·  posted 3y ago by trichoplax‭  ·  last activity 3y ago by NikNakk‭

code-golf number
71%
+3 −0
How many umbrellas to cover the beach?

You work at a beach. In the afternoon, the sun gets quite hot and beachgoers want to be shaded. So you put out umbrellas. When you put out umbrellas you want to shade the entire beach, with as few ...

2 answers  ·  posted 3y ago by WheatWizard‭  ·  last activity 3y ago by justhalf‭

code-golf array