Questions tagged [number]

A competition to solve a particular problem through the usage and manipulation of numbers.

Filter by
Sorted by
Tagged with
-1 votes
21 answers
827 views

How Many Paint Tins Do I Need?

Task Take in 3 inputs. The length of the wall, the height of the wall and the coverage of the paint. Output how many tins of paint are required. Output Since there's no way to purchase ...
I.T Delinquent's user avatar
4 votes
1 answer
177 views

Convert real numbers between factoradic and positive integer bases

This prompt asked you to convert back and forth to factoradic, but is very limited in scope (only decimal integers from 0 to 10!-1). Your task in this challenge is to reach just a bit further and ...
guest4308's user avatar
  • 149
13 votes
21 answers
4k views

German pharmacy payment

Your task is to calculate the amount you have to pay for prescribed medication at a pharmacy in Germany. The amount is simply based on the full price of the item, which will be your input. It is a ...
corvus_192's user avatar
  • 4,896
-1 votes
1 answer
250 views

It's Just Simple Math! [duplicate]

Task Your boss is on another crusade for 'efficiency.' He wants to encourage the use of numbers with fewer syllables, so that they're easier to discuss in meetings. If you want to take some time off ...
I.T Delinquent's user avatar
20 votes
23 answers
2k views

Diagonal Binary Sequence

Challenge: Given a positive number \$n\$, convert it to binary, and output a sequence where all 1s form a top-left to bottom-right diagonal line, including a ...
Kevin Cruijssen's user avatar
12 votes
12 answers
748 views

Calculate NDos-size of given integer

Objective Given a nonnegative integer, calculate its NDos-size as defined below, and output it. NDos' numeral system The concept of NDos-size comes from the numeral system I made. It represents every ...
Dannyu NDos's user avatar
  • 5,447
15 votes
11 answers
958 views

Convert a non-negative integer to Barbrack

Barbrack Your task is to write a program or function that takes a non-negative integer (in decimal or any other convenient base for your language), and output a number in the numbering system Barbrack....
Someone's user avatar
  • 305
9 votes
12 answers
3k views

Funny Numbers :D

The task is to calculate the average "funniness" of a given number given the following scoring system: 1 point for each "420" in it 2 points for each "69" in it 3 points ...
Joseph's user avatar
  • 115
16 votes
10 answers
1k views

Find the longest permutations of integers from 1..k such that all neighbouring pairs sum to a square

OEIS A090461 details the ‘numbers k for which there exists a permutation of the numbers 1 to k such that the sum of adjacent numbers is a square’. This has also been the subject of Matt Parker’s ...
Nick Kennedy's user avatar
15 votes
13 answers
2k views

Keep jumping till a cycle

Objective You're on a nonempty list of integers that wraps around. You start at the leftmost entry of the list, and keep jumping to the right to the amount of the integer entry you're at. Eventually, ...
Dannyu NDos's user avatar
  • 5,447
24 votes
23 answers
4k views

American odds to probabilities

American odds (aka moneyline odds) are numbers like \$+150\$ or \$-400\$ used to express how much a winning bet would pay out. Convert odds to a fair win probability like this: Positive odds \$+n\$ ...
xnor's user avatar
  • 144k
11 votes
20 answers
4k views

Add two really big numbers

Preamble We've already proven we're good at adding two numbers, but many solutions only operate on tiny numbers like 2³²-1, honestly we can do a lot better. The Challenge Given two unsigned, non-...
ATaco's user avatar
  • 10.6k
15 votes
13 answers
2k views

Half even rounding

The round function in Python 3 will round values of the form \$k+\frac{1}{2}\$ (with \$k\$ being an integer) to the nearest even integer, which is apparently better ...
bsoelch's user avatar
  • 5,677
12 votes
18 answers
1k views

Print a meter of numbers to a specified limit

Given a positive integer n, output a number meter formatted like this: ...
TKDKid1000's user avatar
15 votes
16 answers
833 views

Output the smallest increasing sequence where each term is coprime to preceding 3 terms

This sequence is defined as Starts with 1, 2, 3 The next element of the sequence is the first number greater than the previous three that is co-prime with each of the previous 3 elements in the ...
mousetail's user avatar
  • 11.8k
8 votes
8 answers
394 views

Near miss prime multiples

This challenge was originally posted on codidact. Given a number \$n \geq 3\$ as input output the smallest number \$k\$ such that the modular residues of \$k\$ by the first \$n\$ primes is exactly \$\...
Wheat Wizard's user avatar
  • 96.5k
1 vote
1 answer
158 views

Start a program so that /proc/self/cmdline contains a binary representation of the input number

I am sorry for the very long description. But i think some information of how /proc/self/cmdline works and how it can be used to get a integer input was necessary. ...
12431234123412341234123's user avatar
10 votes
13 answers
1k views

Landmine Number IV

Background You have again x3 been given the task of calculating the number of landmines in a field. But this time, we have no landmine number, and some landmines have exploded. You must calculate the ...
Jacob Creutzfeldt's user avatar
14 votes
19 answers
3k views

Vanilla Natural Logarithm Challenge

There is a challenge for multiplying two numbers so I guess this counts too Given as input a positive real number n compute its natural logarithm. Your answer ...
mousetail's user avatar
  • 11.8k
10 votes
13 answers
2k views

Landmine Number II

Background You have again been given the task of calculating the number of landmines in a field. However, we have now travelled into the flatlands. You must calculate the landmine score given a list/...
Jacob Creutzfeldt's user avatar
13 votes
27 answers
2k views

Landmine Number I

Background You have been given the task of calculating the number of landmines in a field. You must calculate the landmine score given a list/string of numbers and the landmine number. The landmine ...
Jacob Creutzfeldt's user avatar
21 votes
32 answers
2k views

Reversed Squares

Given an integer n, your task is to determine whether it is a perfect square that when reversed, is still a perfect square. You may assume n is always positive. When numbers such as 100 (10x10) are ...
Alan Bagel's user avatar
  • 3,443
6 votes
6 answers
724 views

Detect Maxima Using Persistent Homology

Inspired by this SO answer about peak detection. Background Persistent homology is a fancy term for a fancy math concept, but in this case all we care about is how it can be used for peak detection. ...
CursorCoercer's user avatar
47 votes
38 answers
3k views

Last odd digit of power of 2

Task Given \$n\$, output position of the last odd digit in the decimal representation of \$2^n\$ (counting from the end). Rules There are no odd digits for \$n=1,2,3,6,11\$ \$(2, 4, 8, 64, 2048)\$ - ...
pajonk's user avatar
  • 15.1k
15 votes
6 answers
1k views

Cube calendar numbers

Credit: Marco Verch CC BY 2.0 A two-cube calendar, as shown in the picture, uses two cubes with digits painted on the faces to display the date. For dates in the range 1-9, a leading zero is used (&...
AnttiP's user avatar
  • 7,828
22 votes
11 answers
3k views

How powerful must this e approximation be?

This challenge was inspired by this non-challenge about the natural logarithm base \$e\$ and the following pandigital approximation to \$e\$ appearing on a Math Magic page: $$\left|(1+9^{-4^{7×6}})^{3^...
Parcly Taxel's user avatar
  • 3,707
20 votes
23 answers
2k views

Borders of a Rectangular Matrix

Although it's done a few times as sub-challenge of a larger challenge, and we also have a challenge to remove the borders of a square matrix, I couldn't find a challenge to output the borders of a ...
Kevin Cruijssen's user avatar
12 votes
17 answers
2k views

Compute cumulative means efficiently

Consider a sorted array of positive floating point numbers such as: input = [0.22, 2.88, 6.35, 7.17, 9.15] For each integer \$i\$ from 1 up to the last value in ...
Simd's user avatar
  • 1,812
24 votes
5 answers
2k views

Add two real numbers ... probably

The problem statement here is pretty simple, take two real numbers on the range [0,1) as input and output their sum, with probability 1. The catch here is that there are a lot of real numbers. There ...
Wheat Wizard's user avatar
  • 96.5k
12 votes
15 answers
1k views

The number of solutions to Hertzsprung's Problem

Hertzprung's Problem (OEIS A002464) is the number of solutions to a variant of the Eight Queens Puzzle, where instead of placing \$n\$ queens, you place \$n\$ rook-king fairy pieces (can attack like ...
bigyihsuan's user avatar
  • 8,588
14 votes
7 answers
1k views

Gödel encoding - Part II (decoding)

Part I Previous part was considered encoding of non-empty nested lists with a positive integer. Reminding the coding procedure \$G(x)\$: If \$x\$ is a number, \$G(x) = 2^x\$ If \$x\$ is a list \$[n_0,...
lesobrod's user avatar
  • 3,239
31 votes
18 answers
3k views

Gödel encoding - Part I

Related but different. Part II Taken from the book: Marvin Minsky 1967 – Computation: Finite and Infinite Machines, chapter 14. Background As the Gödel proved, it is possible to encode with a unique ...
lesobrod's user avatar
  • 3,239
11 votes
7 answers
2k views

Zahlen auf Deutsch! (Numbers in German)

Your task is to write a program that receives a base 10 number from 0 to 99 and outputs the German name of that number with non-ASCII characters replaced with ASCII equivalents. German number names <...
Creative Name's user avatar
16 votes
7 answers
2k views

How Super is this Prime?

A super prime is a prime whose index in the list of primes is also a prime: ...
Lecdi's user avatar
  • 1,155
8 votes
3 answers
571 views

Doors and guards

Related but noticeably different You are the leader of the guard in the dungeon of an ancient castle. There are N doors in the dungeon and ...
lesobrod's user avatar
  • 3,239
13 votes
4 answers
1k views

Is it a Frog List?

Challenge: A Frog List is defined by certain rules: Each frog within a Frog List has an unique positive digit [1-9] as id (any 0...
Kevin Cruijssen's user avatar
19 votes
56 answers
5k views

Implement the `<=>` three-way comparison operator on numbers

In C++, there exists a a <=> b three-way comparison operator that, for numerical types, does the following: If a < b, ...
bigyihsuan's user avatar
  • 8,588
0 votes
6 answers
417 views

Generate number from given range

Your function must accept three numbers in any order: A signed real number (or ±Infinity) - The number (N) for which you have ...
EzioMercer's user avatar
  • 1,473
15 votes
16 answers
1k views

Imtiaz Germain Primes

Description "Imtiaz Germain primes" is not a technical name in Mathematics, but my weird creation, in the memoir of the famous mathematician Sophie Germain. These primes can be generated by ...
Aitzaz Imtiaz's user avatar
16 votes
7 answers
1k views

Largest Binary Area

Take the sequence of all natural numbers in binary, (1, 10, 11, ..) then write them vertically beside each-other like this (least significant bit on top; 0s have ...
mousetail's user avatar
  • 11.8k
11 votes
16 answers
986 views

Multibase Numbers

(Similar: Through the bases) Normally, our number system is base ten, with the digits 0123456789. However, we can increase or decrease the base count (so ...
Infigon's user avatar
  • 561
18 votes
24 answers
2k views

Shortest code to generate all Pythagorean triples up to a given limit

Generate the shortest possible code in any programming language that can generate all Pythagorean triples with all values not exceeding a given integer limit. A Pythagorean triple is a set of three ...
Aitzaz Imtiaz's user avatar
10 votes
5 answers
386 views

Consolidate a 6-axis 2-dimensional Vector

Typically, when we want to represent a magnitude and direction in 2D space, we use a 2-axis vector. These axes are typically called X and Y: This isn't always convenient, however. The game BattleTech ...
Pavel's user avatar
  • 9,369
12 votes
71 answers
3k views

Summing the Digits of a Number

Challenge Given a non-negative integer, find the sum of its digits. Rules Your program must take a non-negative integer as input. Your program should output the sum of the digits of the input ...
Aitzaz Imtiaz's user avatar
11 votes
5 answers
604 views

Whole Number Groups

Given a list of fractions, group them so that each group sums to a whole number. This should be done in such a way to maximize the number of non-empty groups. You may assume a solution exists. Order ...
mousetail's user avatar
  • 11.8k
12 votes
6 answers
609 views

Number Clusters

Your task is to create a program or function, that when given an input list of nonnegative integers of length \$l \ge 2\$ and a nonnegative integer \$c\$ where \$2 \le c \le l\$, group the list into \$...
Yousername's user avatar
  • 3,650
13 votes
16 answers
1k views

Find opposite string

Your function must accept one string and return the opposite The opposite string is a string where all characters go in reverse order, all letters are replaced with the opposite mirror letter from the ...
EzioMercer's user avatar
  • 1,473
17 votes
19 answers
3k views

Print all pandigital numbers

Given a base as input, output all pan-digital numbers. A number is pan-digital if it includes every digit in that base at least once, possibly multiple times. Every number is considered to contain an ...
mousetail's user avatar
  • 11.8k
9 votes
15 answers
2k views

Sum of numbers of arbitrary length

Your function must accept 2 strings which are correct numbers. It needs to sum them up (without rounding and floating point errors) and return the result (which is also a correct number) without any ...
EzioMercer's user avatar
  • 1,473
22 votes
27 answers
3k views

Sum of Consecutive Squares

Your task Given a integer input, \$ n \$ (such that \$ n > 1 \$), decide whether it can be written as the sum of (at least 2) consecutive square numbers. Test cases Truthy: ...
The Thonnu's user avatar
  • 17.8k

1
2 3 4 5
26