Implement Uiua's 'tuples' function
In the programming language Uiua, there is a higher-order function called tuples which is a generalization of getting the permutations or combinations of an array. Tuples takes a list \$ a \$, a sample size \$ r \$, and a function \$ f \$ taking two numbers repr...
Maple is designed for mathematical computation, with a focus on symbolic algebra, calculus, and data visualization. I’m experimenting with code golf in Maple and want to make my scripts as concise as possible. What are some clever techniques for reducing character count in Maple? I’m especially i...
Sidef, created by Daniel Șuteu, is designed for expressive, compact code, especially in mathematical domains (e.g., number theory, combinatorics). I’m diving into code golf challenges using Sidef and want to minimize my character count. What are some expert tips for writing shorter Sidef code? I’...
Fortran is a compiled imperative language known for its numerical and scientific computing strengths. It blends traditional procedural programming with some modern features like array operations.
What general tips do you have for golfing in Fortran? I'm looking for approaches and tricks that are ...
COBOL is a high-level, compiled programming language designed for business applications, readability, and long-term maintainability. It emphasizes verbose syntax, English-like readability, and robust support for data processing, file handling, and business logic. COBOL's structure is divided into...
What are some general tips you have for golfing in Bespoke? I want answers that are specific to Bespoke (e.g. don't just say "remove comments"). One tip per answer.
Esolangs page
Documentation
Official interpreter
(and also the threat to modern cryptography is very much a known aspect of "we haven't proven P!=NP but we just. really really want to assume it because like no way is it not true", granted there's also overlap with post-quantum cryptography and whatnot)
The shortest NP-complete problem
Find an NP-complete problem over all ASCII strings, and present a solver for the problem in the programming language of your choice.
This is a code-golf; the solver with the fewest bytes wins.
Your submission must present a proof that the problem in question is in...
Find duplicates in a given string
code-golfstring
Challenge
Given a string of any length, determine if there are any duplicate characters in the string.
Rules
Standard I/O methods are permitted. Standard loopholes are forbidden.
This is code-golf, so shortest solution in bytes wins!
Examples
"abcdef
Antiparallel 12-hour Clock Hands
Print each of the 11 times, one per line, in the I:M:S format, at which the hour and minute hands of a 12-hour clock are antiparallel. Here I is the two digit hour, with 12 in place of 0; M is the two digit minute, and S is the truncated seconds value.
The output ...
Given an unsorted list of unique, positive integers, output the shortest list of the longest possible ranges of sequential integers.
INPUT
An unsorted list of unique, positive integers
e.g. 9 13 3 11 8 4 10 15
Input can be taken from any one of the following:
stdin
command-line arguments
...
Recently, in an Analysis class, I was tasked with proving that the dyadic rationals are dense in R (which can be proven by the archimedean property).
The dyadic rationals are defined as:
$$\left\{ \dfrac{m}{2^n} \; | \; m \in \mathbb{Z},\; n \in \mathbb{N} \right\}$$
Your Goal: for two real numbe...
Count collisions in a python dictionary
hashing python code-golf
Task
Given a list of integers as input, simulate Python's dictionary insertion process and count the total number of collisions that would occur. The process works as follows:
Start with a hash table of size 8
For each number in th...
Relevant discussion that inspired this question
Questions and answers (content) generated by AIs like LLMs (e.g ChatGPT, Google Bard, character.ai) are not prohibited on the StackExchange network by default:
With due consideration, we've decided no network-wide, general policy regarding banning ...
Position 9 queens and least obstacles on an 8×8 chessboard so that no two queens threaten each other.
There's more than one solution. Output all of them. Shortest code in each language wins.
@Themoonisacheese Didn't even notice that you'd posted that :p - just saw that my answer had gotten an upvote and realised I could save two bytes on it
Uiua is a stack-based array programming language, and with the great power of a stack comes the great responsibility of having to manage it. In this task you will take on the role of the Uiua interpreter for a small subset of the language concerning the rearranging of values on the stack.
If you'...
…granted, it doesn’t help that I’m not actually using JS or TS and the bindings I’m using are godawful in their own idiosyncratic ways on top of that :P
The situation: I maintain a Web site. I was working with a local copy of one of the site’s pages and a local copy of the CSS stylesheet file that is used by that page (the CSS stylesheet is used by more than one page on the site.) I edited the stylesheet to specify custom left and right margins f...
I saw the following problem on MathsSE:
You try to do something and your probability of success is \$p\$. If you fail, you try again, but the probability of success falls down to \$p^2\$. If you fail again, you try again, but the probability of success is now down to \$p^3\$. If you fail, you ke...
Basic Uiua Planet Notation
code-golf uiua
Sandbox note: I have another challenge in the works which expands on this one and includes more complicated "planet notation" expressions.
Uiua is a stack-based array programming language, and with the great power of a stack comes the great responsibility...
Python3, 184 bytes
def f(n):
q=[(0,0,[(0,0)])]
for x,y,p in q:
if len(p)==2*n:yield p;continue
q+=[(*T,p+[T])for X,Y in[(0,1),(0,-1),(1,0),(-1,0)]if 0<=x+X<2 and 0<=y+Y<n and(T:=(x+X,y+Y))not in p]
Try it online!
A snake is defined as a path around a two dimensional grid which touches each square exactly once by repeatedly moving one up/down/left/right, starting at the square (0, 0). Below is an example of one snake of a 3x4 grid:
0 1 2 3
7 6 5 4
8 9 10 11
For any positive integer N, there are N s...
Q&A on metas
I feel the Q&A format is just inherently bad for meta sites. I also want to say that Q&A does not need to be completely gone, but metas can at least be diversified with the type of content. Or maybe we throw out Q&A and adopt another model.
In general, Q&A seems antithetical to metas...
The task is to compute the convolution of an array with itself as quickly as possible. The array will contain 80-bit extended precision long doubles and I will specify how the array is to be created. In order to get a good range, the values will be sampled on a log scale and then scaled back up ...
DeepBleak
This challenge is about probing the limits of an LLM's reasoning skills. The basic idea is to create short DeepSeek prompts that produce long bodies of reasoning text and an objectively incorrect answer. More precisely:
Participating
Create a DeepSeek account (it's free).
Start a new c...
N-Step pyramid calculator.
Calculate the number of blocks per column of an N step pyramid built using Y block, and return the number of blocks per column in a list. The build must use every single block, even if the result is an lopsided pyramid. The blocks can be placed in the right columns fir...
Zig is a low-level, statically typed, and compiled systems programming language designed for safety, performance, and simplicity. It provides direct control over hardware with an emphasis on explicit memory management, zero-cost abstractions, and no hidden control flow. Zig's syntax is concise, a...
The task is to compute the convolution of an array with itself as quickly as possible. The array will contain 80-bit extended precision long doubles and I will specify how the array is to be created. In order to get a good range, the values will be sampled on a log scale and then scaled back up ...