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.

0
votes
2answers
124 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 \$+\$ ...
24
votes
15answers
3k views

Matrix Jigsaw Puzzles

Input: An integer n Two equal-sized square matrices (with their width/height being a multiple of n) Output: One of two ...
24
votes
38answers
2k views

Enumerate each series of identical numbers in-place

Given a list of strictly positive integers, go through each distinct number and replace all occurrences of it with successive indices (zero or one based) of a new series. Examples ...
6
votes
11answers
384 views

Mis-decode a date

Background Inspired by a now deleted question by John Burger from which I quote: Now obviously no human made this mistake. It's a mis-decode of something - perhaps the ISBN? My question is: ...
5
votes
1answer
262 views

Surreal Numbers

Surreal Numbers Surreal numbers are one way of describing numbers using sets. In this challenge you will determine the value of a surreal number. Intro A surreal number consists of two sets: a left ...
11
votes
7answers
319 views

Approximate the proportion of integers with neighboring factors

If 1 is not counted as a factor, then 40 has two neighboring factors (4 and 5) 1092 has two neighboring factors (13 and 14) 350 does not have two neighboring factors (out of its factors 2, 5, 7, 10, ...
1
vote
0answers
68 views

Sino-Korean numerals [duplicate]

The Korean language has two sets of numerals, a native Korean numerals and Sino-Korean numerals. The native Korean numerals are mostly used for numbers under 100, such as age and time. The Sino-...
27
votes
20answers
2k views

Convert to Suzhou numerals

Suzhou numerals (蘇州碼子; also 花碼) are Chinese decimal numerals: 0 〇 1 〡 一 2 〢 二 3 〣 三 4 〤 5 〥 6 〦 7 〧 8 〨 9 〩 They pretty much work like Arabic numerals, except ...
0
votes
3answers
160 views

Round the digits last digit, over and over

Challenge: Given two inputs, x and y, round x to one less significant figure, then repeat until it has y number of unrounded digits left. (the decimal point does not count as a digit) Input & ...
16
votes
7answers
562 views

Satisfying Rounding

Satisfying Rounding You know when you're in science class, and asked to round to 2 sig figs, but your answer is 5.2501...? You should round to ...
10
votes
1answer
494 views

Golf a number bigger than Loader's number

As a follow up to Shortest terminating program whose output size exceeds Graham's number and Golf a number bigger than TREE(3), I present a new challenge. Loader's number is a very large number, ...
13
votes
26answers
1k views

Self-contained powers

Given integer n, output the smallest exponent e greater than 1 such that n^e contains ...
31
votes
42answers
4k views

Print all lexicographically increasing numbers under 10000

A lexicographically increasing number is an integer whose digits are in strictly increasing order. Print all lexicographically increasing numbers under 10000. Here are lines of the expected output: ...
0
votes
2answers
147 views

Number letter counts [closed]

If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. Output how many letters would be used if all the numbers from ...
7
votes
3answers
841 views

Largest Number in Brainfuck BigInt for each program length up to 50 instructions

This challenge is for the largest finite number you can get BrainFuck programs of given lengths to contain in memory. We must use one of the BF versions that uses big integers for the cells rather ...
23
votes
25answers
2k views

Sort by Largest Digit(s)

Challenge: Given a list of integer, sort descending by their single largest digit(s). The order for numbers with the same largest digit are then sorted by second largest digit, etc. We ignore ...
15
votes
30answers
2k views

Upward and onward to greater glory!

May this challenge serve as (another) tribute to Stan Lee, who passed away aged 95. Stan Lee has left us an invaluable legacy and a peculiar catch word: Excelsior. So here's a small challenge based ...
10
votes
9answers
1k views

Through Space and Time

Introduction: In general we usually speak of four dimensions: three space dimensions for x, y, and ...
12
votes
40answers
2k views

Print the Lost numbers

As a big fan of the Lost TV series, I always got intrigued by the sequence of numbers that repetitively appears on the episodes. These numbers are: \$ 4, 8, 15, 16, 23, 42\$ (A104101) Using any ...
0
votes
4answers
429 views

Fastest algorithm to output array containing all integers in range excluding duplicate digits

Input is a single integer in ascending digit order. The only valid inputs are: 12 123 1234 ...
7
votes
12answers
821 views

Decimal Digit Truncating

Input: A decimal Output: The input truncated How to truncate them? The integer part of the input will remain the same. The decimal part of the input will be truncated based on the lowest digit in ...
6
votes
4answers
156 views

Seeking Substantial Subcollections

(thanks to @JonathanFrech for the title) Challenge Write a program or function that, given a collection of positive integers \$S\$ and a positive integer \$n\$, finds as many non-overlapping ...
5
votes
1answer
102 views

Minimum 1's to get 1-expression for n [duplicate]

Background Challenge is inspired by this question. The 1-expression is a formula that in which you add and multiply the number 1 any number of times. Parenthesis is allowed, but concatenating 1's (e....
-4
votes
20answers
380 views

Array indexes to number and number reversed

Given an input array having minimum length 2 and maximum length 9 having any initial values output an array having length ...
20
votes
36answers
8k views

IP address or not?

Your network scanning tool is annoyingly picky about input, and immediately crashes if you feed it an IPv4 address that contains improper characters or isn't properly formatted. An IPv4 address is ...
37
votes
51answers
9k views

List all possible titles for the Anno games

In the Anno video game series there are 6 games with a 7th one announced for early 2019. Their titles always feature a year in a specific pattern: ...
21
votes
23answers
2k views

Minimal Power Root

The minimal power iteration of a number \$n\$ is defined as follows: $$\text{MPI}(n):=n^{\text{min}(\text{digits}(n))}$$ That is, \$n\$ raised to the lowest digit in \$n\$. For example, \$\text{MPI}(...
33
votes
25answers
5k views

Can the number be split into powers of 2?

Yesterday while playing with my kid I noticed the number in his toy train: So we have $$4281$$ that can be split into $$4-2-8-1$$ or $$2^2-2^1-2^3-2^0$$ So simple challenge: given a non-negative ...
15
votes
5answers
809 views

The Binary Fences

Input: An integer n in the range 2 <= n <= 10 A list of positive integers Output: Convert the integers to their binary ...
15
votes
9answers
605 views

Stagger, stack, sum

Inspired by this Stack Overflow question. The challenge Input An array of square matrices containing non-negative integers. Output A square matrix built from the input matrices as follows. Let \$...
-3
votes
5answers
76 views

Concatenate 2 numeric type values to a fixed size number [closed]

You have 2 numbers, both stored separate as numeric data type. First number is always 6 digits long. Second number can vary between 1 and 4 digits. If it's less than 4 digits, it needs to be padded ...
10
votes
13answers
884 views

Multiply and Divide

Given a value x find the smallest numerical value greater than y that is capable of being multiplied and divided by x while retaining all original digits. The new numbers do not lose digits. The new ...
17
votes
18answers
4k views

Longest Repeating Subsequence of a Single Digit

Challenge: Given a positive integer, output the longest single-digit subsequence that occurs at least twice, AND has boundaries of another digit (or the start/end of the integer). An example: Input:...
31
votes
41answers
5k views

Half, Half Half, and, Half

Consider the following number sequence: \$ 0, \frac{1}{2}, \frac{1}{4}, \frac{3}{4}, \frac{1}{8}, \frac{3}{8}, \frac{5}{8}, \frac{7}{8}, \frac{1}{16}, \frac{3}{16}, \frac{5}{16}, \frac{7}{16}, \...
16
votes
18answers
5k views

Simplistic Lava Lamp

Introduction: I think everyone knows what a Lava Lamp is, but in case they do not: (Image source) They're basically glass tubes that contain wax in a translucent liquid. The bottom part is heated ...
17
votes
39answers
1k views

Sum \$\text{Square}^2\$

Let \$n=42\$ (Input) Then divisors are : 1, 2, 3, 6, 7, 14, 21, 42 Squaring each divisor : 1, 4, 9, 36, 49, 196, 441, 1764 Taking sum (adding) : 2500 Since \$50\times 50=2500\$ therefore we return ...
23
votes
38answers
2k views

Expand some number

This challenge is based on this Stackoverflow question. With a positive number as input, output it as the sum of each digit multiplied by its power-of-10 representation. Input A number, as an ...
21
votes
15answers
2k views

Crown hundred crownty crown

I noticed a certain game had a peculiar life counter, which instead of stopping at 999, gained a new digit – the next number was crown hundred or ...
7
votes
3answers
316 views

Print a Quinella Table

ALERT: IN CASE YOU DOUBT, NO PUN ON "QUINE" IS INTENDED In regulated horse-racing for gambling, bets called Quinella bets exist and in which a person bet on the first two places of a race. In ...
13
votes
52answers
2k views

Are all three integers distinct?

You will be given 3 integers as input. The inputs may or may not be different from each other. You have to output 1 if all three inputs are different from each other, and 0 if any input is ...
14
votes
2answers
364 views

Impatient divisibility test

Your task is to write a program or function that determines whether a number is divisible by another. The catch is that it should give an answer as soon as possible, even if not all digits of the ...
7
votes
17answers
549 views

Extract and Divide

Challenge For a given positive integer \$n\$: Repeat the following until \$n < 10\$ (until \$n\$ contains one digit). Extract the last digit. If the extracted digit is even (including 0) multiply ...
0
votes
0answers
127 views

Make n n n n = x [duplicate]

Background So I've been inspired by this puzzleing SE question to create a similar Code Golf challenge. The basic puzzle format is you must use 4 numbers, such as 5 5 5 5, to equal some other number, ...
13
votes
7answers
647 views

Make the biggest and smallest numbers

Inspired by this post over on Puzzling. Spoilers for that puzzle are below. Given three positive integers as input, (x, y, z), construct the inclusive range ...
11
votes
16answers
2k views

Prime numbers in large number

Given a large number (in base 10), such as 1234567891011121314151617, find prime "subnumbers" in it. A prime "subnumber" is a consecutive sequence of digits (taken from the input), which represents a ...
26
votes
23answers
2k views

Compare version numbers

When we publish some software, we assign a version number to it. And users may want to update to the latest version of some software. So, it is the time to find out which version should be newer. ...
18
votes
34answers
3k views

Tower of strings

Given a string of text, output it as a 'tower'. Each slice of the string (of the form 0:n) is repeated 5*n times, so the first ...
17
votes
22answers
2k views

Sort by what the digit pairs describe

Given a positive integer, we can form a new number that's described by its digits taken pairwise (with a leading 0 added for numbers with odd number of digits). For eg.: 1234 can be read as one 2, ...
9
votes
6answers
457 views

Codegolf Rainbow : Sorting Colors with Reflection

Introduction: After I posted two rainbow-related challenges: Codegolf Rainbow : Fun with Integer-Arrays 1 and Codegolf Rainbow : Draw in Black-and-White 2, the following comment was made by @ChrisM ...
29
votes
18answers
1k views

Custom Number Base Converter

The powers that be want to be able to quickly convert any number they have into their own number base using any format they would like. Input Your program must accept 3 parameters. Number: The ...