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.

27
votes
13answers
1k views

Seqindignot sequence

Title is made up, from 'Sequence Index Digit Not'. Challenge: Given an integer n which is >= 0, output the ...
9
votes
6answers
572 views

Output all distinct permutations of a vector

Challenge: Output all distinct permutations of a, potentially long, list of positive integers. You may assume that the vector has less than 1,000 numbers when testing, but the process should in ...
20
votes
8answers
874 views

Pick-flatten a list

Consider the process of "picking" a nested list. Picking is defined as follows: If the argument is a list, take an element from the list at random (uniformly), and pick from that. If the argument is ...
22
votes
11answers
3k views

Bijective function ℤ → ℤⁿ

It is trivially possible to create a bijective function from \$\mathbb{Z}\$ (the set of all integers) to \$\mathbb{Z}\$ (e.g. the identity function). It is also possible to create a bijective ...
28
votes
36answers
3k views

Find the unique twins

You will be given two Arrays / Lists / Vectors of non-negative integers A and B. Your task is to output the highest integer N that appears in both A and B, and is also unique in both A and B. You ...
7
votes
7answers
587 views

How many Latin Squares?

A Latin Square is a square of size n × n containing numbers 1 to n inclusive. Each number occurs once in each row and column. An example of a 3 × 3 Latin Square is: ...
11
votes
13answers
1k views

Levenshtein distance & OEIS (Robbers)

This is the Robber post. The Cop post is here. Your task is to take an integer input N and output the Nth digit in the sequence OEIS A002942. The sequence consists of the square numbers written ...
16
votes
15answers
2k views

Levenshtein distance & OEIS (Cops)

This is the Cop post. The Robber post is here. Your task is to take an integer input N and output the Nth digit in the sequence OEIS A002942. The sequence consists of the square numbers written ...
29
votes
27answers
2k views

Concatenative counting

Your challenge is to write N snippets of code such that, when you concatenate the first K ≥ 1 together, they produce the number K. The higher N, the better. Here's the catch: you may not use any ...
28
votes
25answers
4k views

Smallest Zeroless Base

Given a positive integer n, output the smallest base b >= 2 where the representation of n ...
43
votes
43answers
9k views

Implement the iOS 11 Calculator

iOS 11 has a bug that makes the result of 1+2+3 to be 24. This is related to the animation speed, but anyway: The task is to make 1 + 2 + 3 == 24. But only that. ...
19
votes
31answers
4k views

Am I a golfy array?

Definition and Rules A golfy array is an array of integers, where each element is higher than or equal to the arithmetic mean of all the previous elements. Your task is to determine whether an array ...
16
votes
10answers
671 views

Triangular Numbers

(no, not those ones) The Challenge You'll be given two inputs. The first is a positive integer n > 0, which is used to output an ...
14
votes
25answers
2k views

Hopping numbers

TASK print integers n, where 12 <= n <= 123456789, and all pairs of consecutive digits in n have the same positive difference between them (e.g. 2468 but not ...
28
votes
72answers
3k views

Square pyramidal numbers

A000330 - OEIS Task Your task is simple, generate a sequence that, given index i, the value on that position is the sum of squares from ...
3
votes
1answer
166 views

Did you hear about alphametics? [duplicate]

Task The letters spell out actual words, but if you replace each letter with a digit from 0–9, it also “spells” an arithmetic equation. The trick is to figure out which letter maps to each digit. All ...
12
votes
23answers
2k views

Sum the means of the two integers

There are quite a few means in mathematics, such as the arithmetic mean, the geometric mean, and many others... Definitions and Task Note that these are the definitions for two positive integers*: ...
11
votes
22answers
1k views

Exponent of complex numbers

Given two integers, which may be negative, zero, or positive, a and b (taken in any reasonable format, including inputting a ...
16
votes
26answers
3k views

Detect the Zeroless Numbers [duplicate]

Zeroless numbers are numbers that do not contain 0 as one of their decimal digits. Given an integer K, return the Kth zeroless number. K will be non-negative if you choose 0-indexing, or positive if ...
17
votes
9answers
1k views

Sequence of integer square roots

Let's define a sequence of integer square roots. First, a(1) = 1. Then, a(n) is the smallest positive integer not seen before such that ...
15
votes
24answers
2k views

I am greater than you! [duplicate]

Write a function or program that given a list of non negative integers, arranges them such that they form the largest possible number. INPUT [50, 2, 1, 9] ...
14
votes
14answers
750 views

Recursively concatenated cumulative sums of [N] with M iterations

Take two positive integers N and M and create the concatenated cumulative sums of [N], with <...
4
votes
3answers
147 views

Make a list continuous! [duplicate]

Take an input list L containing positive integers, and insert the least amount of integers into the sequence, so that you make it a continuous one. Example: ...
14
votes
19answers
2k views

A Euro-iginal Sequence

Given a positive integer n output the n-th number of the euro-iginal sequence. Calculating the Sequence This sequence is equal to OEIS A242491. A number is part of said sequence if the number can ...
14
votes
18answers
2k views

Prime Factoral Roots

Inspired by digital roots, the prime factoral root of a number is the number that emerges when you take the prime factors of a number, add them together, and repeat the process on the resulting number,...
15
votes
20answers
3k views

Narcissistic array elements

Definition Narcissistic 1 integers of an array think they are better than their neighbours, because they are strictly higher than their arithmetic mean. Neighbours are defined as follows: If the ...
6
votes
9answers
2k views

Back to the Basics of Math

Introduction: We all know these three basic arithmetic math tables I assume. ...
8
votes
6answers
734 views

90% fail this challenge?

I guess I'm not the only one who have seen this kind of image on Facebook (and other sites). The picture above was posted 16 days ago, and has accumulated 51 k comments. Some answers: 0, 4, 8, 48, ...
29
votes
48answers
9k views

How many Wazirs can be placed on an N×N Chessboard?

Suppose a new fairy chess piece named the Wazir is introduced to chess. Wazirs can move from a position (x, y) to:  (x+1, y)  (x, y+1)  (x-1, y)  (x, y-1) That is, they move orthogonally like the ...
0
votes
3answers
115 views

Prime Factorial [duplicate]

For the purposes of this question, the prime factorial of a number n is the result of multiplying all prime numbers smaller than n, and then multiplying the result by n. Your Task: Write a program ...
9
votes
14answers
971 views

Increasing, decreasing, none or all?

Take two inputs, a non-empty vector/list containing digits 1 and 2 and a string (no, you may not take ...
50
votes
42answers
3k views

Illustrate the Least Common Multiple

Given two positive integers, A and B, illustrate their least common multiple by outputting two lines of dashes (-) with length LCM(A, B) after replacing every Ath ...
22
votes
10answers
3k views

Generate Numpad-Friendly Numbers

Inspired by Generate Keyboard Friendly Numbers. Background Many number pads have the following layout: 789 456 123     0     We define a number's ...
40
votes
48answers
7k views

Am I an insignificant array?

An insignificant array is an array of positive integers, where the absolute differences between consecutive elements are all smaller than or equal to 1. For example, the following array is ...
15
votes
27answers
1k views

Pandigital Doubling

Inspired by this CMC Given a positive integer greater than 0, perform the following operation on it: If all ten single digits (1234567890) are in the number at ...
-5
votes
33answers
787 views

Is it a completely even number?

A completely even number is a positive even integer whose divisors (not including 1) are all even. Some completely even numbers are 2 (divisors: 2, 1), 4 (divisors: 4, 2, 1), 16 (divisors: 16, 8, 4, ...
18
votes
18answers
1k views

Reverse Maths Cycles

Inspired by this In the linked challenge, we are asked to apply addition to the elements of the original and the reverse of the input array. In this challenge, we are going to make it slightly more ...
19
votes
14answers
2k views

How many Lynch-Bell numbers are there?

Challenge Given an integer, n, as input where 36 >= n >= 2, output how many Lynch-Bell numbers there are in base ...
14
votes
29answers
3k views

Weird grading system

Weirdo Incorporates have a weird way of grading their staffs by the number of days they were present in the office: ...
5
votes
4answers
234 views

Implement the Fibonacci sequence… Shifted to the right [duplicate]

Background We all know the famous Fibonacci sequence, where each term is the sum of the previous two, with the first term being 0 and the second one being ...
15
votes
25answers
2k views

Max power of 2 such that 2^m divides n. (The ruler sequence) [duplicate]

Input: A positive integer N. Challenge: Suppose you have a list of integers n = 1, 2 ... N. Output a list of integers, where each number is the maximum power of 2, m, such that 2^m divides each ...
28
votes
6answers
2k views

Help! My calculator malfunctions!

Introduction My calculator is behaving weird. Sometimes when I type in an 8 it displays a 2. And sometimes when I type in a <...
19
votes
27answers
2k views

Calculate the area of a regular polygon

Given an integer, n, where 3 <= n < 2^32, calculate the area of a regular n-gon with ...
14
votes
14answers
2k views

Generate strong primes [duplicate]

In number theory, a strong prime is a prime number that is greater than the arithmetic mean of the nearest prime above and below (in other words, it's closer to the following than to the preceding ...
6
votes
17answers
960 views

Shifting digits

Given a string representing a number and the base that number is in, shift each positional value upward, wrapping back to zero if the value cannot increase. You will never be provided invalid input, ...
8
votes
16answers
1k views

First spiral, then diagonal

Given a positive input number n, construct a spiral of numbers from 1 to n^2, with ...
19
votes
43answers
3k views

Get the best of two Arrays

You will be given two arrays of floating-point numbers. Your task is to pair the corresponding elements of the two arrays, and get the maximum of each pair. However, if the two corresponding elements ...
7
votes
1answer
311 views

Playing Darts: become an amateur with the most efficient prioritizing

Introduction: I think most people will know how darts work. But since some might not, here are the rules of playing Darts in a nutshell: Amount of players: 2 Starting points: 501 Goal: Get your ...
22
votes
22answers
2k views

Modular multiplicative inverse

Your task is to given two integer numbers, a and b calculate the modular multiplicative inverse of a modulo b, if it exists. ...
16
votes
11answers
795 views

Sequence Without Sevens [duplicate]

This challenge is based on a drinking game. I advise against alcohol consumption while programming. In this game, the players count up in turns: the first player says ...