All Questions
13,897
questions
14
votes
14
answers
2k
views
Print all Polynomials
The set of all polynomials with integer coefficients is countable.
This means that there is a sequence that contains each polynomial with integer coefficients exactly once.
Your goal is it to write a ...
2
votes
0
answers
84
views
Tips for golfing in Thue
Anyone got tips for golfing in Thue. One tip per answer, and no tips aplicable to all languages (like remove comments)
21
votes
23
answers
4k
views
"Print this diamond" gone beautifully wrong
Write a function (or a whole program) that outputs (or prints) the following ASCII art:
Output:
...
11
votes
22
answers
2k
views
Generate the Crystal Maze™ time matrix
Behold! The Crystal Maze™ Time Matrix!
...
1
vote
1
answer
158
views
Start a program so that /proc/self/cmdline contains a binary representation of the input number
I am sorry for the very long description. But i think some information of how /proc/self/cmdline works and how it can be used to get a integer input was necessary.
...
11
votes
11
answers
1k
views
(Robbers) Fast and Golfiest Season 1: The Lord of the Strings
Fast and Golfiest Robbers Thread
Welcome to the first season of Fast and Golfiest, a cops-and-robbers challenge! I designed this challenge to encourage competitive coding for efficiency (fastest ...
17
votes
15
answers
1k
views
(Cops) Fast and Golfiest Season 1: The Lord of the Strings
Fast and Golfiest Cops Thread
Welcome to the first season of Fast and Golfiest, a cops-and-robbers challenge! I designed this challenge to encourage competitive coding for efficiency (fastest ...
23
votes
15
answers
3k
views
Code Golf for Golf
My first code golf question post! Hope u like it ;-)
The task is simple. Write either an stdin-stdout program or a function. Input is a 2D array which contains only either characters or the integer <...
19
votes
10
answers
3k
views
Numbers that can be negated by reading backwards
Balanced ternary is a modified version of ternary (base 3), using the three digits 1,0 and -1...
19
votes
41
answers
1k
views
Output / Convert to unary number
Your task is it to output a number as a unary string. You get the number of a non-negative integer input in the range of 0 - 2'000'000'000.
Rules
You can choose any character for the digit you like. ...
1
vote
7
answers
476
views
Relations between interval and semitones
Output this table:
-2*
-1*
-
0
-
1
2
-1*
0
1
-
2
3
4
1
2
3
-
4
5
6
3
4
-
5
-
6
7
5
6
-
7
-
8
9
6
7
8
-
9
10
11
8
9
10
-
11
12
13
10
11
-
12
-
13
14
You can output one string with two types of ...
21
votes
16
answers
2k
views
Chamber of Reflection
Background
A ray of light is fired from the top left vertex of an MxN Chamber, where M a denotes the width and ...
24
votes
38
answers
2k
views
Diagonalize a vector
Diagonalize a vector into a matrix.
Input
A vector, list, array, etc. of integers \$\mathbf{v}\$ of length \$n\$.
Output
A \$n \times n\$ matrix, 2D array, etc. \$A\$ such that for each element \$a_i \...
0
votes
1
answer
74
views
Find the sum of primes [duplicate]
Given a number x, find the sum of all primes up to that number.
The input will always be a positive number, bigger than 2. An upper limit isn't defined, so data types can be ignored. Use whichever you ...
9
votes
13
answers
987
views
Landmine Number V
Background
You have again x4 been given the task of calculating the number of landmines in a field. But this time, the field is not a number field... it's a field of letters. Our landmine letter ...
7
votes
1
answer
261
views
Reverse Conway's Game of Life
Conway's Game of Life is a cellular automaton "played" on an infinite grid, filled with cells that are either alive or dead. Once given an initial state, the board evolves indefinitely ...
10
votes
13
answers
1k
views
Landmine Number IV
Background
You have again x3 been given the task of calculating the number of landmines in a field. But this time, we have no landmine number, and some landmines have exploded.
You must calculate the ...
14
votes
19
answers
3k
views
Vanilla Natural Logarithm Challenge
There is a challenge for multiplying two numbers so I guess this counts too
Given as input a positive real number n compute its natural logarithm.
Your answer ...
6
votes
6
answers
959
views
Critical Calculations
Background
In the game stick ranger, there is an item which grants the character the ability to get critical hits.
Each time a projectile hits an enemy, it has some probability to be a critical hit (...
22
votes
40
answers
3k
views
Sum of a range of a sum of a range of a sum of a range of a sum of a range of a sum of
Inspired by the fact that a few related challenges to this could be answered by Vyxal in 0 Bytes using a special flag combination.
Given only one input integer \$n\$, calculate \$f(n,n)\$ where
$$ f(x,...
11
votes
14
answers
2k
views
Landmine Number III
Background
You have again, again been given the task of calculating the number of landmines in a field. But this time, the field is foggy.
You must calculate the landmine score given a list/string of ...
11
votes
6
answers
697
views
Compute the maximal Ducci period
Given an initial \$n\$-tuple \$t_0=(t_{0,1},...,t_{0,n})\$, we can obtain its corresponding Ducci sequence \$\{t_0, t_1, ...\}\$ by the recurrence \$\displaystyle t_{i+1}=\left(\left|t_{i,1}-t_{i,2}\...
13
votes
11
answers
2k
views
Measure the Diamond Road
Background
You are planning your trip away from the Diamond City, and must travel through Diamond Road. However, Diamond Road branches away from Diamond City to different locations.
Out of curiosity, ...
10
votes
13
answers
2k
views
Landmine Number II
Background
You have again been given the task of calculating the number of landmines in a field. However, we have now travelled into the flatlands.
You must calculate the landmine score given a list/...
13
votes
27
answers
2k
views
Landmine Number I
Background
You have been given the task of calculating the number of landmines in a field.
You must calculate the landmine score given a list/string of numbers and the landmine number.
The landmine ...
13
votes
8
answers
695
views
Generate all linked chains
A followup to this challenge by Jeremy Collprav, inspired by DLosc solving this in Regenerate. Some sections copied from the linked challenge.
Linking chains
We define a chain to be a string ...
14
votes
15
answers
1k
views
Two Parallel Linked Chains
Background
We define the two types of chain to be a string that contains only dashes, "-", or only underscores, "_". We link two chains using one equals sign, "=".
...
12
votes
17
answers
2k
views
Draw the initial positions of Mölkky pins in ASCII art
Write a function (or a whole program) that outputs (or prints) an ASCII art of the initial position of Mölkky pins.
Output :
...
21
votes
32
answers
2k
views
Reversed Squares
Given an integer n, your task is to determine whether it is a perfect square that when reversed, is still a perfect square. You may assume n is always positive.
When numbers such as 100 (10x10) are ...
10
votes
5
answers
869
views
Translate the keitai input method
The keitai input method is a method for writing Japanese kana on a 12-key phone keypad. Similar to Western keypads, each kana is assigned to a key; when the key is pressed multiple times, it cycles ...
6
votes
6
answers
724
views
Detect Maxima Using Persistent Homology
Inspired by this SO answer about peak detection.
Background
Persistent homology is a fancy term for a fancy math concept, but in this case all we care about is how it can be used for peak detection. ...
23
votes
43
answers
3k
views
Output each second
With roughly one second (plus or minus 10 ms) between outputs, output anything.
The first output must be at most one second after the start of the program, but can be as soon as right when the program ...
8
votes
5
answers
1k
views
Approximate e using small numbers
Given an input integer from 1, 2, ..., n, the task to write code to make a number as close as possible (as measured by absolute distance) to e using only the four ...
8
votes
6
answers
219
views
Minimum partition with non-empty intersections
Given a set of intervals \$\mathcal{I} = \{I_1, \ldots, I_m\}\$, where each interval \$I_j\$ is represented by its bounds \$(a_j, b_j)\$, find a partition \$\mathcal{T}\$ of \$\mathcal{I}\$ of minimal ...
17
votes
18
answers
2k
views
XOR of independent Bernoulli variables
In probability theory, a Bernoulli variable is a random variable which has a single parameter \$p\$, and is equal to 1 with probability \$p\$, and 0 with probability \$1-p\$.
In this challenge, there ...
-9
votes
9
answers
314
views
Wrt "Hello World" prgrm bt wth n vwls
Create A "Hello, World!" program but without any vowels. Winner is the program with the least bytes.
Rules:
No vowels are allowed in the code.
Must print to STDOUT
Must be a full program.
...
4
votes
4
answers
205
views
Tips for golfing in (,) in-paren-comma
What tips do you have for golfing in (,)? I've found that there are so many ways to make code shorter, and I want more ways. I doubt there even are any tips for (,) that are applicable in the majority ...
25
votes
15
answers
2k
views
Vertices of a regular dodecahedron
A regular dodecahedron is one of the five Platonic solids. It has 12 pentagonal faces, 20 vertices, and 30 edges.
Your task is to output the vertex coordinates of a regular dodecahedron. The size, ...
1
vote
0
answers
107
views
Bunny Shakespeare poetry [closed]
Suppose you have a grid of cells that is 6 wide and arbitrarily tall. In each cell is a word. Let the bottom row, which is row #1, be the last 6 words of sample.txt in order. Let the second to last ...
6
votes
0
answers
305
views
Crazyhouse chess KoTH
What is Crazyhouse Chess?
Crazyhouse Chess is a chess variant that is basically normal chess except you can place a piece you previously captured back on the board instead of a regular turn.
Bot ...
12
votes
10
answers
3k
views
Calculate max depth of JSON data
Challenge
Given some JSON data, calculate the maximum depth reached. (Both arrays and dictionaries increase the depth)
Input/Output
The program is expected to read a JSON string from stdin and as soon ...
1
vote
0
answers
139
views
making a binary string palindrome using xor operations [closed]
Problem
You are given a binary string A of length N.
You can perform the following type of operation on the string A:
Choose two different indices \$i\$ and \$j\$ (\$1 \le i\$, \$j \le N\$)
Change \$...
47
votes
38
answers
3k
views
Last odd digit of power of 2
Task
Given \$n\$, output position of the last odd digit in the decimal representation of \$2^n\$ (counting from the end).
Rules
There are no odd digits for \$n=1,2,3,6,11\$ \$(2, 4, 8, 64, 2048)\$ - ...
23
votes
28
answers
1k
views
Lowest digit addition generator
A digit addition generator of an integer n is any integer x that satisfy the equation ...
1
vote
0
answers
110
views
Print all semimagic squares [closed]
I am working on a code to print all semimagic squares [1] of a given size. I am working with the following definition:
An \$n\times n\$ consists of numbers \$1,2,\cdots, n^2\$.
All numbers must be ...
14
votes
5
answers
3k
views
Sudoku as a SAT problem
Background
An interesting way to solve a Sudoku puzzle is to represent it as a Boolean satisfiability problem, and then feed it to a SAT solver.
A Boolean Satisfiability Problem (abbreviated as SAT ...
5
votes
4
answers
205
views
Tips for golfing in Arturo
Arturo is a bytecode-compiled/interpreted, garbage-collected general-purpose language filling a role similar to JavaScript, Python and Ruby. It is centered around the concept of blocks, which hold ...
8
votes
5
answers
2k
views
What is the shortest regex for the month of January in a handful of the world's languages?
What is the shortest regular expression equivilant to the following?
...
18
votes
3
answers
2k
views
Render text in a slanted ASCII-art font
Given a text input such as:
THE QUICK
BROWN FOX
JUMPS OVER
THE LAZY
DOG
render the following output:
...
19
votes
24
answers
2k
views
Split a string on unnested commas
Create the shortest program/function/whatever that splits an inputted string along un-nested commas. A comma is considered nested if it is either within parentheses, brackets, or braces.
Input and ...