Questions tagged [number]
A competition to solve a particular problem through the usage and manipulation of numbers.
1,300
questions
14
votes
11
answers
1k
views
Find all Belphegor primes
A Belphegor number is a number of the form \$(10^{n+3}+666)*10^{n+1}+1\$ (1{n zeroes}666{n zeroes}1) where \$n\$ is an non-negative integer. A Belphegor prime is a ...
11
votes
22
answers
1k
views
Closest to a square
The task
Given a positive integer c, output two integers a and b where ...
7
votes
6
answers
461
views
Build the smallest number
Given a non-empty list of digits 0 though 9, output the smallest number that can be produced by an expression formed by reordering these digits and introducing exponentiation signs ...
-2
votes
1
answer
112
views
How to find the original value based on modulus/reminder and some other information [closed]
This might be a very basic question in terms of math,
x % constant = x_modulus
(x + some_number) % constant = y_modulus
Given the value of ...
7
votes
22
answers
1k
views
Calculate The Digit Sum
Your task is to get two numbers, and output the digit sum of them. We'll define digit sum as the following:
take the decimal (base 10) digits of each of them, and pad with 0s the shortest number (e.g....
21
votes
41
answers
2k
views
Binary Reduce a List By Addition With a Right Bias
Given a list of 2 or more strictly positive integers, sum the first and last half of the list, with the middle element being counted only in the right half if the list has an odd number of elements
...
12
votes
10
answers
2k
views
The "skip-pure" numbers
The skip-pure numbers are defined with this rule:
...
15
votes
5
answers
793
views
Base-phi converter time!
The Golden Ratio Bureau is obsessed with this new thing they call base-phi. You see it and decide to code-golf, as is your natural instinct.
To be specific, base-phi is a number system like base 10, ...
31
votes
16
answers
2k
views
Evaluate Conway chained arrow notation
Background
Conway chained arrow notation is a notation to express very large numbers. It consists of zero or more positive integers separated by right arrows, e.g. \$2 \to 3 \to 4 \to 5 \to 6 \$.
...
16
votes
8
answers
723
views
Multiple, Lit Plume, Mute Pill and so on
We say two positive integers are anagrams of each other if the digits in one of them (in decimal representation) can be rearranged to form the other. Leading zeros don't count. For example, 110020222 ...
22
votes
15
answers
2k
views
Donation arms race
The barfoos, a hypothetical alien species, go about charity in an interesting way.
Every morning, barfoo Specialists come up with an ordered list of causes to donate to, and for each cause they ...
18
votes
9
answers
2k
views
Missile-mounted cameras
You are employed as Administrator in charge of Road Maintenance and Planning. The intelligence division of the Agency for Road Maintenance and Planning has come up with a brilliant and not at all ...
23
votes
53
answers
2k
views
Generate list of numbers and their negative counterparts
A recent SO question asks for a convenient one-liner to generate a list of numbers and their negative counterparts in Python.
Given two integers \$1≤a≤b\$, generate all the integers \$x\$ such that \$...
24
votes
11
answers
2k
views
Find a Similar Number
We consider two integers to be similar if, when written in decimal, have the same length, and if we compare characters in any two positions for both decimal strings, the comparison results (less, ...
19
votes
22
answers
4k
views
Convert to and from Base 94
The challenge
Make 2 programs which convert decimal to and from base 94, or a bidirectional program.
Base 94?
Base 94 is like any other base, but instead of 0 to 9 and letters, it uses ASCII ...
21
votes
27
answers
3k
views
A bit of a digital XOR
Here are the first 100 numbers of a sequence:
...
3
votes
5
answers
202
views
Find the binary period [duplicate]
We know that not all fractions have a terminating binary representation. However every fraction can be written as a leading portion followed by a repeating portion. For example \$1/3\$ starts with \$...
27
votes
9
answers
847
views
Mad Libs number sequences
My robot for generating Mad Libs-style sequence challenges has gone rogue! To defeat it, I need you to write code that can solve all the challenges it can crank out.
Your input is three selections ...
27
votes
12
answers
3k
views
Any lips images
Introduction
The \$n\$-ellipse is a generalization of the ellipse with possibly more than two foci. Specifically, given \$n\$ points on the plane, called foci, the \$n\$-ellipse is the set of points ...
20
votes
8
answers
1k
views
Counting Distinct Real Roots of Low-Degree Polynomials
Challenge: I want to know about the real roots of polynomials. As a pure mathematician, I care about the existence of such roots, rather than their numeric values.
The challenge is to write the ...
23
votes
22
answers
4k
views
Find self-locating strings in a number
Based on this Numberphile video
A self-locating string is a number (or set of numbers) in a decimal expansion which corresponds to its location, from the start of the decimal.
For example, take the ...
18
votes
7
answers
1k
views
How many unique one sided polyominos
Context
From Wikipedia:
A polyomino is a plane geometric figure formed by joining one or more equal squares edge to edge.
one-sided polyominoes are distinct when none is a translation or rotation of ...
22
votes
49
answers
3k
views
Is it a doubling sequence?
A doubling sequence is an array of numbers where each subsequent number is at least twice the previous number.
Given an ordered list of numbers, determine if the numbers in the list (\$n_{x}\$) have ...
11
votes
5
answers
209
views
Count switches in a smallest square root sequence mod \$2^n\$
Definition
For any \$a\equiv1\ (\text{mod }8)\$ and \$n\ge3\$, there are exactly 4 roots to the equation \$x^2\equiv a\ (\text{mod }2^n)\$. Now, let \$x_k(a)\$ be the smallest root to the equation \$...
14
votes
18
answers
1k
views
Find the Inverse Neighbor Pairs
Definition
We say a pair of integers \$(a,b)\$, where \$0<a<b<N\$ and \$N\$ is an integer larger than 4, is an inverse neighbor pair respect to \$N\$ if \$ab\equiv1\text{ }(\text{mod }N)\$ ...
20
votes
14
answers
1k
views
Number of palindrome splits
In this task you will take as input a non-negative integer \$n\$, and output the number of pairs of non-negative integers \$a,b\$ such that both are palindromes*, \$a \leq b\$, and \$a+b = n\$. For ...
21
votes
25
answers
2k
views
Power-Ending Patterns
When you look at the last decimal digit of each power of a non-negative integer a repeating pattern forms. For example, 3:
...
46
votes
56
answers
9k
views
Shift right by half a bit
The challenge is to implement a program or function (subsequently referred to as "program") that takes a nonnegative integer \$n\$ as input and returns \$n\over\sqrt{2}\$ (the input divided by the ...
25
votes
17
answers
989
views
Cartesian LCM of two arrays
Given two nonempty arrays of natural numbers \$a\$ and \$b\$, return the shortest nonempty array of pairs of natural numbers \$q\$ such that the sequence of first elements of \$q\$ consists of a whole ...
16
votes
6
answers
3k
views
What's the Mayan date?
Just over seven years ago, everybody suddenly stopped talking about the Maya people. It is time to rectify that!
For clarification, I am talking about the Mesoamerican Long Count Calendar. Your ...
15
votes
9
answers
455
views
Partitioning Digits into Distinct Integers
Given a sequence of base-10 digits, output the longest list of integers that contains all the digits exactly once, in the order in which they appeared in the input, without repeating any integers.
...
0
votes
1
answer
221
views
Determine if a number is less than another [closed]
Introduction
Your job is to write a function or program that detects if a number a is less than a number b.
But... You are not ...
12
votes
1
answer
319
views
Maximal 2-distance Sets
In the plane (\$\mathbb R^2\$) we can have at most five distinct points such that the distances from each point to every other point (except itself) can assume at most two distinct values.
An example ...
17
votes
1
answer
709
views
Is this ordinal prime?
You are given an countable ordinal \$1 < r < \varepsilon_0\$. Determine whether or not it is prime. If not, provide exactly two ordinals \$r_0, r_1 < r\$ such that \$r_0r_1 = r\$, following ...
25
votes
44
answers
5k
views
Round up my number
Sandbox
Given two positive integers a and b, return the smallest multiple of b that is greater than or equal to a.
Examples
Definitions: true = ...
17
votes
23
answers
3k
views
Size Does Matter (at least referring to bottles)
Introduction
I have an even number of bottles, all of different sizes. Unfortunately, I only know the size of the smallest bottle: 300ml.
I also know the following:
Half of the bottles are twice ...
-6
votes
2
answers
414
views
Fastest N times Hello World (Java/C/ C++) [closed]
Not a new one:
Input
N, being n, 0 ≤ n ≤ 5.
Output
N times "Hello World."
Example:
Input
3
Output
Hello World.
Hello World.
Hello World.
These 2 are my ...
10
votes
23
answers
2k
views
Max of the reversed of two numbers
Given two real numbers (postive or negative) in the limits of float pointing number data types, i.e., (\$-3.4e38\$ to \$3.4e38\$) not inclusive, you should output the max of the two reversed numbers.
...
16
votes
6
answers
870
views
Roman Numeral Counting
Roman numerals can be (mostly) written in a one column format, because each letter intersects the top and the bottom of the line. For example: I, or 1 intersects ...
15
votes
11
answers
2k
views
Reach the number in minimum steps
In this challenge, you are given a number x. You have to find the minimum number of steps required to reach x from 1. At a particular point, you have two choices:
1) Increment the number by 1.
2) ...
37
votes
10
answers
3k
views
Interpret numbers very literally
To interpret a positive integer very literally, write it in English words (without "and"), replace hyphens with spaces, replace each resulting word with its number value, and concatenate the ...
14
votes
8
answers
571
views
Output integer given a digital clock style input
Input
_ _ _ _ _ _ _ _
| _| _||_||_ |_ ||_||_|| |
||_ _| | _||_| ||_| _||_|
output
1234567890
Rules
...
15
votes
4
answers
511
views
List where pinballs would exit a grid of bumpers from different entrance points
Inspired by this lumosity mini game, Pinball Recall
We start with a rectangular grid (viewed from above) with several bumpers as follows. Entrances/exits are numbered counter-clockwise starting from ...
25
votes
14
answers
3k
views
Are my triangles similar?
Given (in any structure; flat list, two lists of lists, a tuple of matrices, a 3D array, complex numbers,…) the coordinates for two non-degenerate triangles ...
16
votes
10
answers
1k
views
Digit Date Range
NOTE: Since I'm Dutch myself, all dates are in the Dutch dd-MM-yyyy format in the challenge description and test cases.
Challenge:
Inputs:
Start date \$s\$; End ...
5
votes
7
answers
261
views
Replace by most recent nonzero [duplicate]
Given a non-empty list of decimal digits (0, 1, ..., 9), replace each zero by the most ...
44
votes
30
answers
9k
views
French license plates
Sandbox
French License Plates
French license plates come in a sequential order, following a specific pattern of numbers and letters : AB-012-CD
Challenge
Write ...
29
votes
22
answers
3k
views
Calculate the Ultraradical
What is the Ultraradical?
The ultraradical, or the Bring radical, of a real number \$a\$ is defined as the only real root of the quintic equation \$x^5+x+a=0\$.
Here we use \$\text{UR}(\cdot)\$ to ...
27
votes
36
answers
4k
views
Convert a string of digits from words to an integer
Convert a string containing digits as words into an integer, ignoring leading zeros.
Examples
"four two" -> 42.
...
3
votes
9
answers
257
views
Given a sequence of numbers, print out all possible sets such that the sum is less than a number
The problem has 3 inputs.
L: a list of all numbers
size: the size each set can be
max: the max sum amongst each set
The challenge is as follows:
Given L, size and max, construct as many sets from ...