# Questions tagged [atomic-code-golf]

Atomic code golf is scored by the number of operations in a specific fragment of a language you define.

83 questions
Filter by
Sorted by
Tagged with
14k views

### (-a) × (-a) = a × a

We all know that $(-a) \times (-a) = a \times a$ (hopefully), but can you prove it? Your task is to prove this fact using the ring axioms. What are the ring axioms? The ring axioms are a list of ...
• 97.8k
9k views

### Machine Learning Golf: Multiplication

I'd like to propose a different kind of golfing challenge to this community: (Artificial) Neural Networks are very popular machine learning models that can be designed and trained to approximate any ...
2k views

### Multiply with restricted operations

There's a 500 rep unofficial bounty for beating the current best answer. Goal Your goal is to multiply two numbers using only a very limited set of arithmetic operations and variable assignment. ...
• 145k
4k views

### Construct a pentagon avoiding compass use

Rules You will start with only two elements: Points $A$ and $B$ such that $A \neq B$. These points occupy a plane that is infinite in all directions. At any step in the process you may do any ...
• 97.8k
4k views

### Tribute to John Conway: Collatz in FRACTRAN

John Horton Conway was a brilliant mathematician. Among his contributions were three Turing-complete esolangs: Game of Life (esolangs wiki), FRACTRAN (esolangs wiki), and Collatz function (esolangs ...
• 75.2k
5k views

### Make 1s using a bunch of 1s

Your task is to form an expression equaling $11111111111 \text{ (11 ones)}$ using only the following characters: 1+(). Keep in mind that the result is in base ...
• 22.6k
4k views

### Shortest "arithmetic" formula to output 1000 primes

Write a formula using only the digits 0-9, +, *, -, <...
30k views

### Google's doodle on kids coding: shortest program solving all the levels

Today's Google doodle is about Celebrating 50 years of Kids Coding: The goal is program the path of a little bunny so that it can eat all the carrots. There are 4 types of blocks (see pictures below): ...
• 441
4k views

### Calculate n % 12 [closed]

Calculate n modulo 12 for an unsigned 32 bit integer. The Rules: Must work for all n ...
• 1,031
5k views

### Is this number an exact power of -2: (Very) Hard Mode

This is a version of the recent challenge Is this number an integer power of -2? with a different set of criteria designed to highlight the interesting nature of the problem and make the challenge ...
• 6,502
5k views

### Shortest expression for {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}

Given list of integers {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}. For those who interested these numbers are used in weekday calculation. Weekday = ...
• 2,669
13k views

### Build a multiplying machine using NAND logic gates

Based on my previous question of the same type, Build an adding machine using NAND logic gates, this time you're being asked to multiply instead of add. Build a diagram of (two-wire) NAND logic gates ...
• 34.8k
2k views

### Implement a very simple ALU using only NAND gates

Note: This challenge was inspired by Joe Z's many excellent questions surrounding NAND golfing. Description Your goal in this challenge, should you choose to accept it, is to implement a very simple ...
• 1,623
865 views

### Write it into number theory style

Write a mathematical statement, using the symbols: There exists at least one non-negative integer (written as E, existential ...
• 22.3k
963 views

### Prove DeMorgan's laws

Using the the ten inferences of the Natural Deduction System prove DeMorgan's laws. The Rules of Natural Deduction Negation Introduction: {(P → Q), (P → ¬Q)} ⊢ ¬P ...
• 97.8k
6k views

### Determine if an integer is divisible by 3

Your goal is to determine if a number is divisible by 3 without using conditionals. The input will be an unsigned 8 bit number from 0 to 255. Creativity encouraged! You are ONLY allowed to use ...
• 12.1k
1k views

### SKI calculus golf: Half of a Church numeral

Background SKI combinator calculus, or simply SKI calculus, is a system similar to lambda calculus, except that SKI calculus uses a small set of combinators, namely ...
• 75.2k
5k views

### Find the maximum of 3 numbers without branching

This time around your goal is to find the maximum of 3 integers (from -(2^31) to 2^31 - 1 in binary 2's complement) without using branching or loops. You are only allowed to use Inequality/Equality ...
• 12.1k
2k views

On December 4, 2017, the Google Doodle was a graphical programming game featuring a bunny. The later levels were nicely non-trivial and they seemed like a great candidate for an atomic-golf challenge. ...
763 views

### How to golf string output in Chef

I'm attempting to solve a programming golf style programming puzzle. I need to write an 18 character phrase in Chef in less than 32 "lines" of code. In this case, a line counts as an ingredient or an ...
2k views

### Final tribute to John Conway: FRACTRAN self-interpreter

It's time to conclude the series of John Conway challenges of mine. Background A FRACTRAN program consists of an ordered list of fractions. The program starts by taking a single integer as input. Each ...
• 75.2k
2k views

### Abstract Syntax Tree Golfing: FizzBuzz, Python

Summary Implement FizzBuzz in Python, with the fewest possible tokens. Challenge Write a program that prints the decimal numbers from 1 to 100 inclusive. But for multiples of three print “Fizz” ...
• 41.9k
865 views

### Build a minifloat adding machine using NAND logic gates

A minifloat is a binary representation of a floating-point number that has very few bits. The minifloat in this question will be defined as an 6-bit number m, ...
• 34.8k
563 views

### Count the number of disjoint 11 blocks

The task is to count the number of disjoint 11 blocks in a 64-bit word, using the minimum number of straight-line instructions. That is, how many nonoverlapping ...
• 253
1k views

Anyone who is moderately into low level code optimization know about the perils of branching, be it implemented as if-statements, loops or select-statements the possibility of a branch misprediction ...
• 4,395
431 views

### Build the stove controller (physically)

Challenge Build the Wheat Wizard's stove using 2-input NAND gates. The solution with the fewest NAND gates wins. Externally, it works in the following way: (the first line is added from the original ...
• 75.2k
6k views

### Drive a hexadecimal 7-segment display using NAND logic gates

The ubiquitous 7-segment numerical display can unambiguously display all 16 hexadecimal digits as show in this wikipedia .gif Entries for this challenge will create a circuit diagram using NAND logic ...
• 71.9k
818 views

### Densely packed decimal (DPD) to decimal, with logic gates

Inspired by recent popularity of nandgame on TNB, and my own previous challenge. Background Densely packed decimal (DPD) is a way to efficiently store decimal digits in binary. It stores three ...
• 75.2k
2k views

### Hexcellent Minesweeping

Hexcells is a game based off of Minesweeper played on hexagons. (Full disclosure: I have nothing to do with Hexcells. In fact I don't really like the game.) Most of Hexcells rules can be pretty ...
• 97.8k
669 views

### Build a 4-vertex Connectedness Tester using NAND gates

A connected graph is a graph that contains a path between any two vertices. Challenge Build a [2-input NAND-gate] circuit that determines whether a 4-vertex graph is connected. (A gate's 2 inputs can ...
8k views

### Print NxN spiral of ascending numbers [closed]

The numbers should be printed with leading zeroes in a field with length = (number of digits of N^2). Input (N): 4 Output: ...
4k views

### Implement an 8 bit adder

The Challenge Implement a function which accepts two integers whose values range from 0 - 255 and returns the sum of those integers mod 256. You may only use bitwise negation (~), bitwise or (|), bit ...
• 874
1k views

### SKI calculus golf: Hello, World!

Background SKI combinator calculus, or simply SKI calculus, is a system similar to lambda calculus, except that SKI calculus uses a small set of combinators, namely ...
• 75.2k
579 views

### Get Two from One

As we saw in this question complex logical statements can be expressed in terms of the simple connectives of generalized Minesweeper. However Generalized minesweeper still has redundancies. In order ...
• 97.8k
2k views

### Build a bit-counting comparator using NAND logic gates

A bit-counting comparator (BCC) is a logic circuit that takes some number of counting inputs A1, A2, A3, ..., An as well as inputs ...
• 34.8k
617 views

### Branchless (MIPS) assembly code for median of 3

I was trying to write a short MIPS32 code for computing the median of three registers. The rules: Assume that some values are pre-loaded into \$t0, ...
• 221
936 views

An ordinary N-digit combination lock consists of N rotating discs. Each disc has digits 0-9 inscribed in order, and you need to turn them to the correct password to open it. Obviously, if you don't ...
• 2,421
551 views

### Egg hunting in Collatz style

Inspired by The Great API Easter Egg Hunt! Summary Your task is to search for a predetermined integer in the "Collatz space" (to be explained later) using the fewest step possible. ...
• 3,637
1k views

### Build an EBCDIC converter using NAND logic gates

In this question, a mapping is defined between EBCDIC and a superset of ISO-8859-1. Your task is to build a network of two-input NAND gates that will take eight inputs ...
• 34.8k
981 views

Imagine you have two boxes B(x) and B(y), each containing an unknown bit - 0 or 1, and a machine ...
• 15.2k
965 views

### "Atomic" code golf - determine the number of neutrons in an isotope

Your task is to take an string containing an isotope of an element as input, encoded like the following example with the atomic number followed by a space and the IUPAC chemical symbol for the element:...
• 34.8k
1k views

### Sort a list of numbers on the λ-calculus

Write a term on the pure untyped lambda calculus that, when applied to a church-encoded list of numbers, returns it with its numbers sorted in ascending or descending order. Church lists and numbers ...
• 371
454 views

### Collatz sequence on a two counter machine

The Collatz sequence starting from a positive integer n is defined in this way: if n is even then divide it by 2 (n' = n / 2) if n is odd then multiply it by 3 and ...
1k views

### Build a 2-way universal logic processor using NAND logic gates

A 2-way universal logic processor (2ULP) is a network of logic gates that takes two input wires A and B, as well as four other ...
• 34.8k
372 views

### Write biSp in point-free form using as few terms as possible

The Haskell function biSp has type signature ...
• 933
1k views

### Create a universal two-dimensional cellular automaton cell using two-way universal logic processors

In Conway's Game of Life, a cell is in a state of either on or off, depending on the on-and-off state of the eight cells surrounding it. We can simulate this using a logic gate network with some sort ...
• 34.8k
535 views

### Efficient table-lookup computation

The challenge: compute the day of the week from a MM-DD representation of a day in this year (2021). However, you have to write your program in the following subset ...
• 17.3k
834 views

### Crack the Lost Numbers

The Lost Numbers are 4, 8, 15, 16, 23, 42. Your goal is to create an expression to output them all. Your allowed characters are 0123456789, ^+-*/, (), % for modulo and n as the single variable allowed....
• 3,839
493 views

### Use a Finite Combo in Magic the Gathering to Produce Graham's Number

Produce Graham's Number in Magic the Gathering using the fewest number of cards and without using any infinite combos. Rules: Producing Graham's number means do anything that requires Graham's number ...
• 397