Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [number]

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

16
votes
5answers
412 views

Subtract the Folded Matrix

Challenge: Given an NxN matrix where \$N\geq2\$ and one of eight distinct 'folding options', output a 2D array/list with the subtracted values. The eight folding options are: left-to-right; right-to-...
11
votes
6answers
830 views

Group Integers by Originality

Introduction: I collect twisty puzzles. Most twisty puzzles are produced and sold by Chinese companies. Most well-known companies ask permission from puzzle designers to produce their designs and ...
14
votes
31answers
1k views

Incremental Ranges!

Your task is to, given two positive integers, \$x\$ and \$n\$, return the first \$x\$ numbers in the incremental ranges sequence. The incremental range sequence first generates a range from one to \$...
20
votes
22answers
2k views

Rotated Position of Integers

Challenge: Input: A sorted list of positive integers. Output: The amount of integers which are still at the exact same index, after rotating the digits in each integer its index amount of times ...
8
votes
4answers
597 views

Leading and Suffering Numbers

Introduction: In Dutch, the words leading and suffering, being 'leiden' and 'lijden' respectively, are pronounced the same way. One is written with a "short ei", and one with a "long ij", as we ...
34
votes
18answers
2k views

Count rotary dial pulses in a phone number (including letters)

In your grandparents' day, dialing a phone number was done with a rotary dial like this: To dial each digit, put your finger in the corresponding hole, pull it over to the finger stop, and release it....
18
votes
22answers
2k views

To exponential digit growth and beyond!

Challenge Given a base \$1 < b < 10\$ and an index \$t \ge 1\$, output term \$x_t\$, defined as follows: \$x_1 = 11_{10}\$ \$x_{i+1}\$ is obtained by converting \$x_i\$ to base \$b\$ and then ...
-3
votes
13answers
285 views

Convert a number into “bracket” numerals

"Bracket" numerals are a type of 'numerals' I made up once, and thought would be a nice challenge here. Basically, you convert the input number into base 6, and then transliterate the ...
18
votes
15answers
2k views

Divisor Rich and Poor Numbers

Introduction In the strange world of integer numbers, divisors are like assets and they use to call "rich" the numbers having more divisors than their reversal, while they call "poor" the ones having ...
20
votes
16answers
3k views

​Cuban​ ​Primes

Given a natural number \$n\$, return the \$n\$-th cuban prime. Cuban Primes A cuban prime is a prime number of the form $$p = \frac{x^3-y^3}{x-y}$$ where \$y>0\$ and \$x = 1+y\$ or \$x = 2+y\$ ...
13
votes
12answers
379 views

Find all \$k\$-smooth pairs

Introduction In number theory, we say a number is \$k\$-smooth when its prime factors are all at most \$k\$. For example, 2940 is 7-smooth because \$2940=2^2\cdot3\cdot5\cdot7^2\$. Here, we define a ...
30
votes
19answers
5k views

Is it a Munchausen Number?

A Munchausen Number in base \$b\$, also known as a Perfect digit-to-digit invariant or PDDI is a peculiar type of positive integer where the sum of its base-\$b\$ digits raised to themselves is equal ...
0
votes
3answers
195 views

Roots of Arbitrary Numbers [closed]

One day, when I was bored in maths class, I learned of a neat trick for solving the real cube root of a number! Let's use the number \$79,507\$ as an example. First, take digit in the one's place ...
13
votes
17answers
3k views

Convert Numbers To Emoji Math [closed]

In Emoji Math, a user created module for the video game Keep Talking And Nobody Explodes, numbers are written as strings of emoticons, where each emoticon represents a base 10 digit. Below is the ...
16
votes
22answers
910 views

Enumerate Derangements

Given some positive integer \$n\$ generate all derangements of \$n\$ objects. Details A derangement is a permutation with no fixed point. (This means in every derangement number \$i\$ cannot be in ...
27
votes
22answers
4k views

Binary Numbers Magic Trick

The challenge is simply; output the following six 2D integer arrays: ...
32
votes
21answers
2k views

A ​Note ​on ​N!

J. E. Maxfield proved following theorem (see DOI: 10.2307/2688966): If \$A\$ is any positive integer having \$m\$ digits, there exists a positive integer \$N\$ such that the first \$m\$ digits of \$...
23
votes
20answers
1k views

Maximum summed subsequences with non-adjacent items

Introduction: Inspired by these two SO questions (no doubt from the same class): print the elements in the subarray of maximum sum without adjacent elements java and Maximum sum of non adjacent ...
35
votes
21answers
4k views

Amount of permutations on an NxNxN Rubik's Cube

Introduction: A 3x3x3 Rubik's Cube has \$43,252,003,274,489,856,000\$ possible permutations, which is approximately 43 quintillion. You may have heard about this number before, but how is it actually ...
36
votes
6answers
3k views

List of Python versions

Python is the fastest-growing major programming language today. It is the most wanted language for the third year in a row, meaning that developers who do not yet use it say they want to learn it.[1] ...
8
votes
6answers
1k views

Area of a 2D convex hull [closed]

You are given an array/list/vector of pairs of integers representing cartesian coordinates (x, y) of points on a 2D Euclidean plane; all coordinates are between −104 and 104, duplicates are allowed. ...
1
vote
0answers
149 views

How many right triangles can you find? [closed]

Challenge You will be given an input represented by x, which is a string containing at least 3 characters. It will consist only of the standard numeric characters, ...
19
votes
15answers
2k views

Match Roman Numerals

Challenge Given some input string, return a truthy value if it represents a correct roman numeral between 1 (=I) and 3999 (=...
44
votes
41answers
10k views

Patience, young “Padovan”

Everyone knows the Fibonacci sequence: You take a square, attach an equal square to it, then repeatedly attach a square whose side length is equal to the largest side length of the resulting rectangle....
10
votes
3answers
668 views

How long does it take to type this?

Introduction I can type at a moderate pace, using the QWERTY keyboard layout. But if a word like yellowwooddoor has a ton of repeated letters, it takes a bit longer to type it. Even worse is when a ...
10
votes
5answers
472 views

Valid term from quadratic sequence?

You are given four numbers. The first three are \$a\$, \$b\$, and \$c\$ respectively, for the sequence: $$T_n=an^2+bn+c$$ You may take input of these four numbers in any way. The output should be ...
19
votes
15answers
1k views

Expand and Contract

Take a positive integer \$k\$ as input. Start with \$n := 1\$ and repeatedly increase \$n\$ by the largest integer power of ten \$i\$ such that \$i \le n\$ and \$i + n \le k\$. Repeat until \$n = k\$ ...
27
votes
13answers
3k views

Valid Badminton Score?

Introduction: I saw there was only one other badminton related challenge right now. Since I play badminton myself (for the past 13 years now), I figured I'd add some badminton-related challenges. ...
17
votes
26answers
837 views

Calculating total slots

Given a list of jobs, which must be done in order, with each taking a slot to do, how long will it take to perform them all if after doing a job the same job cannot be done for the next two slots (...
26
votes
22answers
2k views

The Digit Triangles

Challenge: Input: A positive integer \$n\$ Output: Create a list in the range \$[1,n]\$, and join it together to a string (i.e. \$n=13\$ would be the string ...
-1
votes
1answer
106 views

Sort a list of Numbers as letters [closed]

So, you have a random list (random meaning it doesn't matter what order it is in) of numbers with a length of n, where n is a positive integer smaller than 1000 and ...
28
votes
45answers
8k views

Am I not good enough for you?

Background: The current Perfect Numbers challenge is rather flawed and complicated, since it asks you to output in a complex format involving the factors of the number. This is a purely decision-...
30
votes
23answers
8k views

Could you please stop shuffling the deck and play already?

Challenge: Input: A list of distinct positive integers within the range \$[1, \text{list-size}]\$. Output: An integer: the amount of times the list is riffle-shuffled. For a list, this means the ...
12
votes
10answers
580 views

New Order #1: How does this feel?

Introduction Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. ...
64
votes
45answers
6k views

Is it a Cyclops number? “Nobody” knows!

Task: Given an integer input, figure out whether or not it is a Cyclops Number. What is a Cyclops number, you may ask? Well, it's a number whose binary representation only has one ...
30
votes
24answers
5k views

The (Easy) Road to Code

Input: An integer \$n\$, which is guaranteed to be \$\ge3\$. An integer \$d\$, which is one of \$[-1,0,1]\$. Output: A road of size \$n\$, which will be in a north-west direction if \$d=-1\$; a ...
11
votes
31answers
743 views

Sum integers in a string

Input A string. Output The sum of all integers in the line. Constraints 1≤Length of line≤500 Sample test Case Input the 5is 108 seCONd4 a Output ...
12
votes
18answers
947 views

Jumping Numbers

A jumping number is defined as a positive number n which all pairs of consecutive decimal digits differ by 1. Also, all single digit numbers are considered jumping numbers. eg. 3, 45676, 212 are ...
33
votes
5answers
8k views

Historical difference between `/` and `÷` in mathematical expressions

Introduction: Inspired by a discussion that is already going on for many years regarding the expression \$6÷2(1+2)\$. With the expression \$6÷2(1+2)\$, mathematicians will quickly see that ...
71
votes
37answers
12k views

Am I a Rude Number?

For a while now, I've been running into a problem when counting on my fingers, specifically, that I can only count to ten. My solution to that problem has been to count in binary on my fingers, ...
20
votes
15answers
2k views

Square Root Distance from Integers

Given a decimal number k, find the smallest integer n such that the square root of n is ...
19
votes
25answers
2k views

The Highest Dice

Challenge: Here we have the first 100 items of a sequence: ...
23
votes
17answers
4k views

The real treasure was the numbers we made along the way

Your task is to write a program, function or snippet (yes, snippets are allowed) that simply outputs an integer. However, you must be able to separate your submission into prefixes that also produce ...
43
votes
23answers
5k views

Covering a Skyline with brush strokes

Given a non-negative integer skyline height list, answer how many uninterrupted 1-unit-high horizontal brush strokes are needed to cover it. [1,3,2,1,2,1,5,3,3,4,2]...
2
votes
7answers
338 views

Countries by Area

Challenge Given two non negative integers a < b, output all countries, from the below Top 100 Countries, where area is between ...
5
votes
3answers
538 views

A Multipurpose Quine

I personally love quines, but they all seem to be so... static. So why not create a quine that can do more. Challenge The challenge here is to create a quine that without any sort of input is a ...
10
votes
3answers
493 views

Trapped Knight Sequence

Introduction Inspired by the very recent video The Trapped Knight - Numberphile, I came up with a challenge. The trapped knight sequence is a finite integer sequence of length 2016, starting from 1, ...
17
votes
14answers
1k views

Spot all (anti)diagonals with duplicated values

Challenge: Given a matrix input, determine the amount of diagonals and anti-diagonals with duplicated numbers. So if we have a matrix like this: ...
10
votes
14answers
495 views

Prime Difference [duplicate]

Given an integer n, output the smallest prime such that the difference between it and the next prime is at least n. For example, if n=5, you would output ...
1
vote
2answers
202 views

Work out \$x^y\$ using only addition and subtraction [duplicate]

The challenge is to implement a function or program that takes two numbers, \$x\$ and \$y\$ and return the result of \$x^y\$. The program cannot use any other mathematical operation other than \$+\$ ...