Stack Exchange Network

Stack Exchange network consists of 174 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.

19
votes
23answers
2k views

Single swaps of an array

Inspired by Taken from a question at Stack Overflow. The challenge Given an integer n>1, output all arrays that can be obtained by swapping exactly two entries ...
18
votes
13answers
2k views

Is it a Pascal Prime?

It is well known that odd primes will appear in Pascal's triangle exactly twice. However, not all numbers that appear exactly twice in Pascal's triangle are prime. We'll call these numbers Pascal ...
14
votes
7answers
713 views

Could They Be The Same Day Of The Week?

Challenge Given a non-negative integer, output whether it is possible for two dates (of the Gregorian calendar) differing by exactly that many years to share a day of the week. A year is assumed to ...
22
votes
12answers
967 views

Ternary Triangles

The idea of this is mainly from BIO 2017 q1. I got the idea for posting this challenge from my Binary Sequences challenge, since lots of people seemed to like it. Also, this is the first challenge I'...
10
votes
3answers
231 views

Form a list using prime numbers

You have been given N piles of coins. You have decided to divide each of those B1, B2, ..., BN piles among separate groups of people. The amount of people receiving coins has to be a prime number and ...
21
votes
5answers
761 views

Is my number Unique

In this challenge we learned a way to encode every positive integer using factor trees. Here is how it works: The empty string has value of 1. (S) where ...
4
votes
7answers
632 views

Make a Plain PIE!

(2 Jan 2018) Because of the winning criteria I am going to accept the Jelly answer, but I am also giving upvotes to all other answers which all use astounding methods as well Introduction There are ...
22
votes
24answers
2k views

Sample the Pareto Distribution

The Pareto Distribution is a probability distribution that comes up a lot in nature. It has lots of special properties, such as an infinite mean. In this challenge, you will output a number sampled ...
12
votes
16answers
1k views

First and last prime numbers with prime digits of range

Challenge For a given positive integers range, find the first and last prime number entirely composed of prime number digits, exceptionally including 0 (for the digits, a range of 0-2 should output 2-...
11
votes
4answers
223 views

Decode Factor Trees

In case you missed Encode Factor Trees, here is the definition of a Factor Tree: The empty string is 1. Concatenation represents multiplication. A number n enclosed in parentheses (or any ...
27
votes
8answers
705 views

Best Yahtzee score

Yahtzee is a game played with five six-sided dice and a score sheet with thirteen different boxes to fill a score in. Each box has its own scoring rules: 1s, 2s, 3s, 4s, 5s, 6s all score points equal ...
3
votes
5answers
367 views

Help me with my chemistry homework!

Near the middle of the semester in chemistry, we get problems like: Convert 1.283850057 to Scientific Notation and Convert 3.583✕106 to Standard Notation This is just stupid busy work for ...
7
votes
3answers
570 views

The Missing Number - Version 2

Background: This question is a remix of the one that I made previously on this forum. The only difference with this one is: the range is significantly larger, AND dynamic. Details below! Also, I'm ...
17
votes
11answers
1k views

Generalized FiveThirtyEight Sequences

Adapted from this FiveThirtyEight riddle. Background Examine the following infinite sequence: 3 3 3 2 3 3 3 2 3 3 3 2 3 3 2 3 3 3 2 ... Let's say the sequence ...
22
votes
3answers
2k views

The Missing Number Revised

Background: I originally posted this question last night, and received backlash on its vagueness. I have since consulted many personnel concerning not only the wording of the problem, but also its ...
0
votes
1answer
150 views

In which number set do I belong? [closed]

Introduction Mathematicians often work with number sets. These are groups of numbers that share common properties. These are number sets are, in order from most specific to most broad: ...
18
votes
31answers
3k views

cool untitled sequence thingy

Let's define fn(k) as the sum of the first k terms of the natural numbers [1, ∞) where each number is repeated n times. ...
6
votes
10answers
577 views

Compute the result of an equation, but with selectable operator precedence

Forget BIDMAS! Write a program that takes an equation and an operator precedence order, and prints the result. Example input format: 1.2+3.4*5.6/7.8-9.0 */+- ...
20
votes
32answers
3k views

Swap the Endianness

As most of you probably know, (byte-addressable) hardware memories can be divided into two categories - little-endian and big-endian. In little-endian memories the bytes are numbered starting with 0 ...
14
votes
15answers
2k views

“Early bird” squares

Definition If you take the sequence of positive integer squares, and concatenate them into a string of digits (i.e. 149162536496481100...), an "early bird" square ...
15
votes
14answers
1k views

Quadrants passed through by a line

Task Given a representation of a line, output the number of quadrants that that line passes through. Valid Representations of a Line You can represent a line as Three signed integers ...
16
votes
23answers
996 views

The sequence of range-exponentiated integers

Consider a triangle where the Nth row (1-indexed) is the array of the first N positive integer powers of N. Here are the first few rows: N | Triangle 1 | 1 2 | 2 4 3 | 3 9 27 4 | 4 16 64 256 5 | 5 ...
24
votes
73answers
4k views

Is it a whole number?

A number is whole if it is a non-negative integer with no decimal part. So 0 and 8 and ...
33
votes
17answers
2k views

Basic ASCII Tallies

Alternate Title: Tally Your Prison Sentence on the Wall Given a number n, output tallies grouped into the traditional 5-per-group and 50 per row. Examples 1 <...
24
votes
23answers
3k views

Take a byte out of it!

Your task is to, given an unsigned integer n, find the largest number which can be created by removing a single byte (8 consecutive bits) of data. Example Given ...
22
votes
10answers
2k views

The lowest initial numbers in a Fibonacci-like sequence

Given a positive integer input N, output the two non-negative numbers, a and b, where a < b, with the lowest possible mean value that will result in the number N being part of the recurring ...
33
votes
30answers
4k views

How long should my microwave run?

I'm hungry. Let's microwave something. Given a numerical input of between 1 and 4 digits, output the number of seconds that the microwave should run. Details The trick is figuring out if the user is ...
13
votes
23answers
1k views

The cyclic sequence of even digits, with odds in between

Consider the following sequence: 1, 0, 1, 2, 4, 1, 6, 8, 0, 1, 2, 4, 6, 8, 1, 0, 2, 4, 6, 8, 1, 0, 2, 4, 6, 8, 0, 1, ... The even digits start from 0 and are ...
11
votes
12answers
1k views

Expand a number

Expand a number Your task is to expand an integer greater than 0 in the following manner: Split the number into decimal digits and for each digit generate a list according to these rules: if the ...
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
563 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
871 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
585 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
666 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] ...