This challenge is intended to be solved by using, manipulating, accepting as input, or outputting numeric values.

learn more… | top users | synonyms

31
votes
3answers
684 views

Computer Generated Cracked Soil

Write a program that takes in an integer from 0 to 65535 (216-1) and generates a unique 500×500 pixel image that looks as similar as possible to these 6 real life images of cracked soil: ...
13
votes
13answers
770 views

Golf the Sequence whose Exponential Generating Function is tangent

Almost every function can be expressed as a polynomial with infinite terms. For example, e^x = 1 + x + x^2/2! + x^3/3! + x^4/4! + ... For example, sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ... The ...
30
votes
22answers
2k views

Leyland Numbers

Given a natural number n, return the n-th Leyland number. Leyland Number Leyland numbers are positive integers k of the form k = x^y + y^x Where x,y are integers strictly greater than 1. They ...
7
votes
8answers
473 views

Excludivisible numbers

Given an integer N, output the Nth positive number K with the following property in decimal base: For each digit I at position P of K, the number formed from K by removing the Pth digit (i.e. I) is ...
24
votes
7answers
715 views

The Ever Amplifying Zigzag

Write a program or function that takes in a positive integer N and outputs the first N numbers of this amplifying zigzag pattern, using only the lines needed: ...
34
votes
28answers
7k views

Weapons of Math Instruction

Last time when I tried to come up with something easy that wasn't a duplicate, it ended up being way too hard.. So hopefully this time it's indeed something newcomers can try as well. Input: An ...
24
votes
12answers
2k views

7-segment differences

I think most people around here know what a 7-segment display for digits is: _ _ _ _ _ _ _ _ | | | _| _| |_| |_ |_ | |_| |_| |_| | |_ _| | _|...
28
votes
15answers
2k views

Turn an Array into a Math Problem

Given a nonempty list of nonnegative integers, consider rewriting it as an arithmetic problem where: A plus sign (+) is inserted between pairs of numbers that increase from left to right (a.k.a. ...
13
votes
21answers
1k views

Approximation of e

We all know that the Euler's constant, denoted by e, to the power of some variable x, can be approximated by using the Maclaurin Series expansion: By letting x equal 1, we obtain Challenge ...
23
votes
21answers
1k views

Sum It Up with a Digital Triangle

Well, sum it down really. Write a program or function that takes in a nonempty list of decimal integers (0-9) and outputs a downward pointing "triangle" of digits with the input list at the top where ...
15
votes
3answers
1k views

Write a program that always prints N when it is shifted N times up the ASCII alphabet

Write a program using only printable ASCII characters that takes no input. For reference, here are the 95 printable ASCII characters in order: !"#$%&'()*+,-./0123456789:;<=>?@...
32
votes
4answers
4k views

The happy Ender problem

The happy ending problem (actually a theorem) states that Any set of five points in the plane in general position has a subset of four points that form the vertices of a convex quadrilateral. ...
12
votes
8answers
988 views

Closest 7-Distinct-Prime Product

(via chat) The OEIS entry A123321 lists the sequence of numbers that are the product of seven distinct primes. For brevity, we'll call this a 7DP number. The first few numbers and their corresponding ...
9
votes
9answers
384 views

What's the Binary Time?

What's the Binary Time? Everybody knows what the normal time is. It's up there in the top-right (or wherever you put it) of your screen. But a question people rarely seem to ask themselves is this: ...
12
votes
2answers
133 views

Self Referential Polynomials

For every given degree n it is possible to construct (at least one) an integral polynomial p such that p(k) (p evaluated in k) is the coefficient of the term x^k in the polynomial for all 0 <= k &...
21
votes
1answer
442 views

Stack Exchanging

Problem Say you have N stacks named S1 through SN, where each Sk (k = 1 to N) contains N copies of the number k. For example, when N = 3 the stacks looks like this: 1 2 3 <- top of stack 1 2 ...
11
votes
6answers
451 views

Longest arithmetic subsequence

Given a non empty finite sequence of integers, return an arithmetic subsequence of maximal length. If there are multiple of the same maximal length, any of them can be returned. Definitions: An ...
15
votes
42answers
1k views

Alternating Sign Sequence

Introduction The sign of a number is either a +, or a - for every non-zero integer. Zero itself is signless (+0 is the same as -0). In the following sequence, we are going to alternate between the ...
-1
votes
0answers
67 views

Written Integers [duplicate]

Task is to write a program that takes an Integer and outputs it's spoken form as a String. Examples: 12 outputs twelve 416 outputs four hundred sixteen 72135 outputs seventy-two thousand one ...
8
votes
12answers
888 views

Maximum Maxima!

Inspired by this question and refined by Luis Mendo. Challenge Given a 2D matrix of integers, each row has a maximum value. One or more elements of each row will be equal to the maximum value of ...
5
votes
5answers
283 views

Make the lowest number square that equals n

A number square containing the values 1, 2, 3, 4 looks like this: 12 34 To work out what a number square is, you first make four numbers by reading across the rows and across the columns; for the ...
11
votes
7answers
406 views

Find a function with cycles of every length

A function is said to have a cycle of length n if there exists an x in its domain such that fn(x) = x and fm(x) ≠ x for 0 < m < n, where the superscript n denotes n-fold application of f. Note ...
16
votes
19answers
1k views

Greatest Number in a Range When The Sum of Squares of its Prime Factors are Subtracted

The formula Take for instance the number 300 The prime factors of 300 are [2, 3, 5] (unique numbers that are factors of 300 and prime) Squaring each of those numbers will give you [4, 9, 25] ...
31
votes
17answers
2k views

Print the nth prime that contains n

This question will be a twist on finding the nth prime number. Challenge You must write a program that will take one input n, and output the nth prime number whose decimal representation contains ...
8
votes
8answers
321 views

Calculate the Numpad Taxicab

Credit goes where credit is due Given two digits, x, and y, calculate the shortest number of horizontal or vertical jumps to get from x to y on a standard numpad, e.g. 789 456 123 00 You can ...
12
votes
1answer
223 views

Find all the Solutions to this Number Puzzle in the Shortest Time Possible

History My company sends out a weekly newsletter to everyone within the company. Included in these newsletters is a riddle, along with a shoutout to whomever in the company was the first to email/...
4
votes
14answers
681 views

Find the number I/O shortest algorithm

Find the shortest function/algorithm to translate these numbers to the ones after the dash: 0 - 0 1 - 10 2 - 20 3 - 30 4 - 40 5 - 50 6 - 60 7 - 70 8 - 80 9 - 90 10 - 100 11 - 115 12 - 130 13 - 150 14 ...
7
votes
4answers
267 views

Three Indistinguishable Dice

Given three dice rolls (integer values from 1-6) in sorted order (so as to be indistinguishable), convert them to the sum of two fair dice with an identical distribution. The answer for three to one ...
21
votes
33answers
4k views

Smallest integers after N divisible by 2, 3, and 4

Give credit to whom credit is due. Objective Given an integer N > 0, out the smallest integers A, B, and C so that: All of A, B, and C are strictly greater than N; 2 divides A; 3 divides B; and ...
17
votes
10answers
2k views

Contaminated Squares

Introduction Let's observe the following square, consisting only of the digits 0 - 9: 1034 4167 8414 3542 The outer shell of this square is: 1034 4 7 8 4 3542 It contains zeros, so we need to ...
14
votes
4answers
635 views

Actually Integer Metagolf

Background Actually (the successor to Seriously) is a stack-based imperative golfing language I created in November of 2015. Like many other golfing languages, it has one-byte commands that perform ...
4
votes
6answers
283 views

Convert header levels to numbers

Introduction Nodes in tree structures (e.g. headings in a long document, law paragraphs, etc.) are often created by assigning a specific header level (h1, h2, etc.) to each item, but outputted with ...
19
votes
19answers
2k views

Finite Cantor's Diagonal

Given a list of N integers, each with N digits, output a number which differs from the first number because of the first digit, the second number because of the second digit, etc. Example Given this ...
17
votes
17answers
2k views

Counting in bijective base 62

The task is to generate all the strings from 'a' to '999' including upper case characters like so: 'a', 'b', 'c' ... 'y', 'z', 'A', 'B', 'C' ... 'Y', 'Z', '0', '1', 2' ... '8', '9', 'aa', 'ab', 'ac' ...
29
votes
9answers
1k views

Between the Lines

While doodling around on square-ruled paper the other day, I came up with the above negative-space font for digits. In case you haven't spotted it yet, the spaces between the above shapes yield the ...
12
votes
7answers
556 views

Print the Nth non-palindromic number

Print the Nth non-palindromic number A palindromic number (in case you don't know) is a number which reads the same backwards and forwards (example, 11). The first 15 non-palindromic numbers are: 10, ...
14
votes
12answers
586 views

Smallest groups in an array

Introduction Let's observe the following array: [1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1] A group consists of the same digits next to each other. In the above array, there are 5 different ...
18
votes
7answers
994 views

Generate n digits of Gijswijt's sequence

Introduction Gijswijt's sequence (A090822) is famously really, REALLY slow. To illustrate: The first 3 appears in the 9th term (alright). The first 4 appears in the 220th term (a long way away, but ...
18
votes
9answers
803 views

The Back-and-Forth Sequence

Imagine a path made up of < and > and ending in a @, e.g. ><>@ A walker starts on the left-most cell. He will traverse the path as follows: If the walker is on a @ cell, he's ...
8
votes
3answers
279 views

One-to-one correspondence between pairs of integers and the positive integers

It is well-known that there are one-to-one correspondences between pairs of integers and the positive integers. Your task is to write code defining such a correspondence (by defining a pair of ...
44
votes
2answers
4k views

Coding Around The Clock

Write a single line program two or more characters long that contains no line terminators and takes no input. For example, your program might be: MyProgram When your program is arranged into the ...
14
votes
8answers
673 views

How much more reputation do I need?

Programming Puzzles and Code Golf has graduated from beta. Soon we will get a custom site design, and with that the reputation boundaries for privileges will go up. A lot of users will lose privileges ...
8
votes
8answers
534 views

Reverse Greek Conversion Golf

Introduction You must create a function to convert Greek numerals into Arabic numerals. The input will be a Greek numeral less than 1000 and more than 0. This is the reverse of my previous challenge. ...
8
votes
9answers
948 views

Greek Conversion Golf

Introduction You must create a function to convert Arabic numerals into Greek numerals. The input will be an integer less than 1000 and more than 0. Algorithm Split number into digits (e.g. 123 ->...
32
votes
18answers
4k views

A Numpad's Knight Numbers

For the non-zero digits on a standard numpad 789 456 123 consider placing a chess knight at any digit and moving it around with any number of normal L-shaped jumps, tracing out a positive decimal ...
27
votes
18answers
980 views

Numbers with Rotational Symmetry

Given an integer, output a truthy value if it is the same upside-down (rotated 180°) or a falsy value otherwise. 0, 1, and 8 have rotational symmetry. 6 becomes 9 and vice versa. Sequence of numbers ...
13
votes
12answers
1k views

In-between fractions

In-between fractions The challenge: You will need to create code that takes atleast 3 inputs; 2 integers and "a fraction representation" - whichever type suits your language for representing the ...
20
votes
14answers
882 views

Generate the minimal remainder sequence

Every number can be represented using an infinitely long remainder sequence. For example, if we take the number 7, and perform 7mod2, then 7mod3, then 7mod4, and so on, we get 1,1,3,2,1,0,7,7,7,7,.......
19
votes
55answers
2k views

Find the program that prints this integer sequence (Robbers' thread)

This is the robbers' thread. The cops' thread goes here. In the cops thread, the task was to write a program/function that takes a positive (or non-negative) integer and outputs/returns another ...
35
votes
71answers
4k views

Find the program that prints this integer sequence (Cops' thread)

This is the cops' thread. The robbers' thread goes here. The last cops-and-robbers thread was already 4 months ago. The cop's task The cop's task is to write a program/function that takes a ...