# Questions tagged [number]

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

999 questions
1k views

### Compressing the Atomic Ionization Energies

This is a different type of compression challenge. In a normal kolmogorov-complexity challenge, you are required to recreate a list exactly. Here, you are allowed to round the values in any way you ...
1k views

### Infer geometric sequences

Haskell has this neat(-looking) feature where you can give it three numbers and it can infer an arithmetic sequence from them. For example, [1, 3..27] is equivalent ...
65 views

### How many logs can you fit into a number? [duplicate]

Challenge Given a real number as input, calculate the number of times which the natural logarithm function ln can be applied to it before the resulting number ...
1k views

### Make Zero From First 'n' Numbers

Challenge The challenge is to write a code that takes a positive integer 'n' as an input and displays all the possible ways in which the numbers from 1 - n can be written, with either positive or ...
1k views

### Find The Local Maxima And Minima

Definition The maxima and minima of a given function are the largest and smallest values of the function either within a given range or otherwise within the entire domain of the function. Challenge ...
4k views

### I want my book to be away from this table

Story So I have a book that I want to separate from my table with nothing but other books. I want to know how many books do I need to achieve this with $n$ book lengths. Here's a visualization ...
809 views

### Extension of the Game of Sevens

Introduction Output all the numbers in specific base that would appear in an adapted version of the game of seven. Challenge Your task is to output all the numbers in a given base in a given range, ...
897 views

### Bottom part of the Hourglass

Challenge: Input: Three integers: bottom-edge length; starting amount of grains of sand; index Output: Output the state of the bottom part of an hourglass at the given index, based on the given ...
2k views

### Find Integral Roots of A Polynomial

Challenge The challenge is to write a program that takes the coefficients of any n-degree polynomial equation as input and returns the integral values of x for which the equation holds true. The ...
2k views

### Olympic Rings Sequence

Challenge: Given an index integer n, either output the n'th item in this sequence, or output the sequence up to and including ...
4k views

### The first n numbers without consecutive equal binary digits

The sequence contains the decimal representation of the binary numbers of the form: 10101..., where the n-th term has n bits. The sequence is probably easiest to ...
2k views

### Find the Missing Numbers in the Fibonacci Sequence Mod K

Inspired by this Math.SE question. Background The Fibonacci Sequence (called F) is the sequence, starting 0, 1 such that each ...
2k views

### Rotation summation

Take a square matrix containing positive integers as input, and calculate the "rotated sum" of the matrix. Rotated sum: Take the sum of the original matrix and the same matrix rotated 90, 180 and ...
745 views

### Are the numbers amicable?

Two numbers are considered amicable if the proper divisor sum of the first is the same as the second number, the second number's proper divisor sum is equal to the first number, and the first and ...
2k views

### Write numbers as a difference of Nth powers

Challenge There are many numbers which can be expressed as the difference of two squares, or as the difference of two cubes, or maybe even higher powers. Talking about squares, there are various ways ...
1k views

### Finding Lonely Primes

Lonely primes (as I call them) are primes, where given a number grid with width w ≥ 3, are primes which do not have any other primes adjacent to them orthogonally ...
3k views

### Square Triangles

A positive integer x is a square triangle number iff there are two different positive integers, y and z, which are smaller than x such that all of the sums x + y x + z y + z are perfect squares. ...
5k views

### Compare two numbers given as strings

I have a problem at work. I need to compare two numbers that come as strings from two different databases. The numbers may come with leading zeroes and/or leading/trailing spaces. So I may have ...
943 views

### Encrypted In Numbers!

The Problem: Two enemy secret agents have devised a wonderful (for you) method of communication! Here’s how the encryption process works: 1) Take the ascii equivalents of each letter. (No spaces, ...
1k views

### Maximum run between identical elements

This is a overhaul of this now deleted question by ar kang. If the OP of that question would like to reclaim this question or has a problem with me posting this I'd be happy to accommodate Given a ...
251 views

### Integer Division Loops

Challenge Given any positive integer supported by your language: Take the input and divide it into two halves. For all divisions in this program, if the input is odd, round one half up and one half ...
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 ...
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 ...
730 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 ...
969 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'...
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 ...
764 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 ...
642 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 ...
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 ...
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-...
224 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 ...
726 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 ...
369 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 ...
644 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 ...
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 ...
3k 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 ...
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: ...
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. ...
579 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 */+- ...
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 ...
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 ...
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 ...
1k 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 ...
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 ...
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 <...
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 ...
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 ...
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 ...