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

learn more… | top users | synonyms

24
votes
36answers
3k views

How even is a number?

The ancient Greeks had this thing called singly or doubly even numbers. An example of a singly even number is 14. It can be divided by 2 one time, and has at that point reached an uneven number (7), ...
13
votes
23answers
539 views

Filter out and add up

Task The task is very simple. Given a non-empty string containing numbers, uppercase and lowercase letters, output the sum of the remaining numbers. For example: a1wAD5qw45REs5Fw4eRQR33wqe4WE ...
4
votes
1answer
63 views

Convert to and from the backwards-factorial number base

I wanted to ask this question: Convert to and from the factorial number system but I'm a couple of years too late! So, instead you must convert to and from the lairotcaf backwards-factorial number ...
12
votes
11answers
2k views

Convert English to a number without built-ins or libraries

This challenge is similar to this other, however I made a restriction (see bold text below) that I think would made it much diffent and (I hope) fun either. The Challenge Write a program or a ...
12
votes
6answers
785 views

Number of steps for a binary search

Given an input of a positive integer, output the number of steps it takes to find the input via a binary search starting at 1. We are simulating a binary search for the integer that was given as ...
6
votes
3answers
138 views

Inverse Champernowne Substrings

The Champernowne Constant is the irrational number 0.1234567891011... extending ad infinum. We've done a question about it before. But this question is about its reciprocal, known as the Inverse ...
27
votes
18answers
3k views

Sort by Multiplying

You should write a program or function that given a list of positive integers multiplies each element with the smallest positive integer possible to create a strictly increasing list. For example if ...
6
votes
1answer
116 views

Implement almost-equals for IEEE numbers

Isn't it annoying when you're working with floating point numbers and your code doesn't work because two numbers are not equal by the least significant bit? Now you can fix that! Write some code that ...
12
votes
4answers
307 views

All the numbers that fit in a string

Write a program or function that takes in a positive integer N. Output a list of all the distinct decimal numbers that can be written in exactly N characters using digits (0123456789), decimal points ...
20
votes
33answers
3k views

Electrical outlet

This is a problem from NCPC 2005. Roy has an apartment with only one single electrical outlet, but he has a bunch of power strips. Compute the maximum number of outlets he can have using the power ...
17
votes
8answers
305 views

Print the Super Collatz numbers

The Collatz Sequence (also called the 3x + 1 problem) is where you start with any positive integer, for this example we will use 10, and apply this set of steps to it: if n is even: Divide it by ...
20
votes
17answers
968 views

Rearranging the sequence

Introduction Let's observe the following sequence (non-negative integers): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ... For example, let's take the first three numbers. These are 0, 1, 2. ...
16
votes
13answers
436 views

Say What You See

The "Look and say" or "Say what you see" sequence is a series of numbers where each describes the last. 1 11 (one one) 21 (two ones) 1211 (one two one one) 111221 (one one one two two ones) 312211 ...
16
votes
8answers
576 views

Spiral Permutation Sequence

We can roll up the natural numbers in a rectangular spiral: 17--16--15--14--13 | | 18 5---4---3 12 | | | | 19 6 1---2 11 | | | 20 7---8---9--10 ...
10
votes
6answers
275 views

Squares in the Squares

Given input of a positive integer n, write a program that completes the following process. Find the smallest positive integer greater than n that is a perfect square and is the concatenation of n ...
6
votes
2answers
165 views

Find the nth base-b digit of (b^k-1)^-2

Task Your task is simple. Write a program or function which takes three positive integer arguments n, k, and b in any order, such that 2 ≤ b ≤ 36, and returns or outputs the nth (1-indexed) base-b ...
12
votes
9answers
367 views

Code words in integer sequences

Introduction Pareidolia: From Ancient Greek; παρα ‎(para, “concurrent, alongside”) + εἴδωλον ‎(eídōlon, “image”). The tendency to interpret a vague stimulus as something known to the observer, such ...
19
votes
23answers
2k views

Distance between two points in n-dimensional space

Here is another simple one: The Challenge Given two points in an n-dimensional space, output the distance between them, also called the Euclidean distance. The coordinates will be rational ...
20
votes
13answers
1k views

What's the point?

Write a program or function that takes in two integers that represent the X and Y coordinates of a point on a Cartesian plane. The input may come in any reasonable format as long as the X value comes ...
10
votes
23answers
691 views

Zeroes in interval

Your task is to write a function or program that takes two non-negative integers i and k (i ≤ k), and figure out how many zeroes you'd write if you wrote all whole numbers from i to k (inclusive) in ...
10
votes
1answer
205 views

Official Dyalog APL 2016 Year Game

A bit of fun (and possibly frustration!) for 2016... Dyalog's "puzzle of the year". Enjoy! The Objective Find APL expressions (other languages are allowed, see Eligibility below) involving exactly ...
16
votes
10answers
1k views

Split, flip and recombine integers

Background It's well known in mathematics that integers can be put into a one-to-one correspondence with pairs of integers. There are many possible ways of doing this, and in this challenge, you'll ...
11
votes
4answers
249 views

Strategies for representing a given large integer using arithmetic expression

I have a specific number in mind, but it's part of a challenge I'm doing, and I don't want people to do (all) the work for me. Here is a number which has the same digits, but shuffled: ...
20
votes
26answers
7k views

List Prime Numbers [duplicate]

Introduction Prime numbers are simple, right? Well, now you get your chance to find out! Challenge You must write a program or function that takes an input n and outputs the first n prime numbers. ...
19
votes
20answers
2k views

The Möbius Function

The Möbius Function The Möbius function is an important number theoretic function. Your submission should accept a positive integer n and return the value of the Möbius function evaluated at n. ...
-9
votes
2answers
138 views

Longest output in 1024 bytes or less [duplicate]

Your job is to generate the largest output in a program with 1024 bytes or less. Rules: Only finite lengths allowed Must be completely self-contained and deterministic In particular, standard ...
16
votes
7answers
771 views

All your base palindromic belong to us

Generate the sequence number of bases in which n is a palindrome (OEIS A126071). Specifically, the sequence is defined as follows: given a number n, express it in base a for a = 1,2, ..., n, and ...
11
votes
6answers
291 views

Trim and Count the Decimals

In this challenge, you will write a program to output how many decimal places are in the input string and trim the input if needed. Examples -12.32 2 32 0 3231.432 3 -34.0 0 -34 023 0 23 ...
7
votes
6answers
317 views

Inverse symbolic calculator

This challenge is based on the idea of Plouffle's Inverter. Write a program in any language that does the following: Takes as input a non-negative rational number X written in decimal, for example ...
20
votes
3answers
424 views

Putting square pegs into square holes

I was intrigued by the design of this graphic from the New York Times, in which each US state is represented by a square in a grid. I wondered whether they placed the squares by hand or actually found ...
20
votes
13answers
842 views

Remove digits, retaining greater number

Introduction This challenge consists in finding the greatest number removing y digits from the original number n which has x digits. Assuming y=2 n=5263 x=4, the possible numbers removing y=2 digits ...
22
votes
5answers
441 views

Fractal Smoke Sequence

Introduction A229037 has a quite intriguing plot (at least for the first few terms): There is the conjecture, that it might indeed have some kind of fractal property. How is this sequence ...
13
votes
5answers
398 views

Format the reputation

You probably do know that the different reputation levels on Stack Exchange are formatted differently when seen from the questions page / a post. There're all the rep-formatting rules: if a user has ...
32
votes
26answers
5k views

Choose The Powerball Numbers!

Powerball is an American lottery that has recently gained attention because the current jackpot (as of January 11, 2016) is the largest lotto prize in history, at about $1.5 billion (USD). Powerball ...
12
votes
7answers
258 views

Base Conversion With Strings

Introduction We've have a few base conversion challenges here in the past, but not many designed to tackle arbitrary length numbers (that is to say, numbers that are long enough that they overflow ...
47
votes
9answers
3k views

Surrounded Countries

Countries own a series of territories on a 1D world. Each country is uniquely identified by a number. Ownership of the territories can be represented by a list as follows: 1 1 2 2 1 3 3 2 4 We ...
23
votes
17answers
1k views

How many peaks in my mountain range?

A list of positive integers can be visualized as a quantized mountain range where each list entry represents the height of one vertical section of the mountains. For example, the list 1, 2, 2, 3, 4, ...
12
votes
10answers
951 views

9 Deaths of the Ninja

Inspired by this conversation in chat. Your goal in this challenge is to emulate a ninja and count how many deaths he has left. Specs You ninja starts out with 9 deaths left. He also gets an ...
53
votes
26answers
1k views

Expand the number

You may remember in first or second grade using expanded form to learn about place value of numbers. It's easier to explain with an example, so consider the number 123. In expanded form it is ...
10
votes
1answer
144 views

Digital Clock Matches Puzzle

There are many puzzles with matches that involve adding, removing, or moving a certain number of matches to create new numbers or shapes. This is like that with a digital clock. Given a valid time on ...
14
votes
2answers
348 views

Euclidean Vectors

Given the ASCII art of two vectors, find the resultant vector's magnitude and degree. Input This can be received via STDIN, read from a local file, or provided through a function call. Here is an ...
39
votes
24answers
4k views

Superstitious hotel elevator

Description Here's a very superstitious hotel elevator in Shanghai:                 It avoids the number 13, because ...
32
votes
25answers
3k views

The Rien Number

The Champernowne constant is a number that is constructed by concatenating the first n numbers, with n tending to infinity. It looks something like this: ...
5
votes
14answers
630 views

10 9 8 7 6 5 4 3 2 1… Print 2016

As a spin-off to my challenge over at Puzzling, your goal is to output 2016. Rules: You must include the numbers 10 9 8 7 6 5 4 3 2 1 in that order. They can be used as individual integers or ...
7
votes
1answer
230 views

I spy with my little eye a number beginning with n++

If you have ever travelled with kids more than about 20 minutes, you will have no doubt heard cries of "Are we there yet?" and "How much further?" So we play games like "I Spy" to help pass the time ...
117
votes
77answers
10k views

What is the smallest positive base 10 integer that can be printed by a program shorter (in characters) than itself?

I think the question as above is clear, but just in case: Write a full program (not just a function) which prints a positive base 10 integer, optionally followed by a single newline. Qualifying ...
3
votes
0answers
146 views

Hamilton is coming to town

It's almost Christmas, so Santa has to plan his route. You're helping him, for reasons unknown. Santa needs help planning the route and wants you to give him a solution, but since you're all ...
36
votes
5answers
584 views

Counting Quipu: Base 10 in the New World

Quipus are an ancient device used by the Inca in the Precolumbian era to record numbers in a base ten positional system of knots on a cord, which works as follows: Each cluster of knots is a ...
18
votes
6answers
354 views

The Kimberling Sequence

Introduction Of course, we've got a lot of sequence challenges, so here is another one. The Kimberling sequence (A007063) goes as following: 1, 3, 5, 4, 10, 7, 15, 8, 20, 9, 18, 24, 31, 14, 28, ...
12
votes
9answers
749 views

Pentagonal numbers made from pentagonal numbers

Introduction A pentagonal number (A000326) is generated by the formula Pn= 0.5×(3n2-n). Or you can just count the amount of dots used: You can use the formula, or the gif above to find the first ...