All Questions
13,808
questions
17
votes
25
answers
3k
views
Is this a powerful number?
A powerful number is a positive integer \$n\$ such that for every prime \$p\$ that divides \$n\$, \$p^2\$ also divides \$n\$. Or equivalently, \$n\$ is powerful if and only if it can be written in the ...
20
votes
13
answers
3k
views
Chinese color mixing
Objective
Given two Chinese ideographs meaning basic colors, output the ideograph that means the color resulting from mixing them.
Basic colors
The basic colors are:
靑(U+9751; blue)
赤(U+8D64; red)
黃(...
1
vote
1
answer
176
views
Most elegant one-liner to generate sqlite INSERTs
Challenge
You find yourself in a bash terminal, and want to do some simple tests
on sqlite3.
So you issue the following command:
...
17
votes
22
answers
2k
views
Compute this fractal matrix
The unique-disjointness matrix ( UDISJ(n) ) is a matrix on all pairs of subsets of {1...,n} with entries $$ U_{(A,B)}=\begin{cases}
0, ~ if ~ |A\cap B|=1\\
1, ~ ...
32
votes
34
answers
2k
views
Make a k-skip-j range
On the Mathematica Stack Exchange, 100xln2 asks:
I need a list of integers […] The list contains integers and is characterized by [three] parameters, lets call them k and j [and listmax], which ...
17
votes
23
answers
3k
views
Meta-cat program
Write a program or function that takes input and outputs/returns a full program (in the same language) that outputs said input.
Note that the input may contain any printable ASCII character or newline ...
9
votes
17
answers
956
views
Continuously Count Consecutive Cases
Background
Imagine that I'm creating a really long necklace, consisting of only two characters, A and B. You must count the ...
7
votes
4
answers
272
views
Simulate Keyboard Inputs
Background
You know how in text editors and just text fields in general, there's always that blinking bar where you type? Yeah, simulate typing there.
You'll be given 3 inputs: The current text field, ...
14
votes
5
answers
790
views
Compute the chromatic number of special graphs
This challenge is about computing the chromatic number of special types of graphs.
Input
The input will consist of two integers.
A positive integer \$n > 1\$.
A distance \$d < n\$.
Task
The ...
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
79
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
152
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
470
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
37
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
982
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
236
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
2k
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
955
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
690
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
26
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
685
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
847
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
714
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
218
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 ...
16
votes
17
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 ...
-8
votes
9
answers
291
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
198
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
106
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
280
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
2k
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 ...