Newest Questions
14,472 questions
- Bountied 2
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
17
votes
6
answers
842
views
Decompose a palindromic polynomial
A palindromic polynomial is a polynomial whose list of coefficients is a palindrome. For example, the polynomial \$p(x) = x^4 + 2x^3 + 3x^2 + 2x + 1\$ is palindromic because its coefficients are \$[1, ...
2
votes
4
answers
575
views
Program Generator: Print a Paragraph
Objective
Your challenge is to write a program that, given a paragraph from a book, will output another program that prints out that paragraph. (See my example program in an answer)
Scoring
The link ...
19
votes
24
answers
2k
views
Add Y to X to get a palindrome
Given X>0, return the smallest Y>=0 such that X+Y is a palindrome. Code golf.
Tests:
5 => 0
14 => 8
200 => 2
819 => 9
1100 => 11
1122 => 99
5
votes
3
answers
406
views
Cancel strings to make them short
Overview
You will be given a list of strings. If any two elements are equal, you can delete both of them. If one element a is a substring of element ...
Ted's user avatar
- 2,407
13
votes
8
answers
1k
views
Float vs Decimal
You will be given a decimal number n in the form of a string. You must determine if that number, when stored in standard number type ...
11
votes
11
answers
908
views
Squared Squares
This came to me in a dream somehow. I've seen similar questions around, but hope this is novel.
The premise is straightforward:
Input: one positive integer.
Output is a pretty square squared using ...
23
votes
5
answers
2k
views
Chinese periodic table of elements (元素周期表)
In Chinese, each chemical element is named with one Chinese character.
(A brief history of the chemical element naming in Chinese can be looked up in Wikipedia.)
Your goal: Print a periodic table of ...
16
votes
16
answers
1k
views
Activate the Laser Gates
In a secret lab corridor, there are emitters and gates: A number represents a laser emitter with a certain frequency, a 0 represents an inactive gate. If two ...
16
votes
7
answers
1k
views
Solve the crossed ladders problem
I'm surprised we don't have the crossed ladders problem as a task here yet.
Two ladders of lengths a and b lie oppositely across an alley, as shown in the figure. The ladders cross at a height of h ...
13
votes
9
answers
2k
views
Pennies to Dollars
Over on Puzzling a couple years ago, Hermant Agarwal proposed the following question:
In a certain country the following coins are in circulation: 1 cent, 2 cents, 5 cents, 10 cents, 20 cents, 50 ...
1
vote
2
answers
170
views
Abuse some parsers your way to a Polyglot [closed]
Many polyglots fill in the blanks between languages by either making code that is ignored in one language or loading code dynamically.
This time, let's write a polyglot that works without that. This ...
15
votes
14
answers
2k
views
IMO 2025: Divisor sums that go forever
Problem 4 of the 2025 International Mathematical Olympiad asked (paraphrased):
Let \$f(n)\$ be the sum of the largest three proper divisors of \$n\,ドル
that is divisors excluding \$n\$ itself. For ...
17
votes
12
answers
921
views
Make the Stars Shine
We've been given a map of the night sky. The map features three single characters, to match the theme, I'll refer to them O, X ...
9
votes
2
answers
409
views
Error-Detecting Quine
Write a program with the following properties:
it must be a quine, i.e. running it outputs precisely the program itself;
it must take no input;
for at least one integer k, it must be the case that ...
13
votes
16
answers
858
views
Make a zigzag array of length n with a defect at position d
In the fewest bytes, in any language, write a function, zigzagdefect(n, d) that takes as input integers n and d < n. The function should return a list of length ...