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.

13
votes
24answers
1k 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 ...
-2
votes
0answers
80 views

Definite Integral of one continue function in a finite interval [on hold]

Definite Integral of one continue function in a finite interval It is given as input 1) one representation of one continue function f (example as one anonymous function or as one string that the ...
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 ...
9
votes
30answers
1k 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
3answers
360 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
803 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
153 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
100 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
355 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
8k 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
800 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
601 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
72 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
871 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
4k 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 ...
16
votes
38answers
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
311 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 ...
11
votes
51answers
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
360 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
543 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
637 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 ...
23
votes
20answers
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
453 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 ...
12
votes
17answers
2k views

Codegolf Rainbow : Draw in Black-and-White

Introduction: (Source: Wikipedia) When we look at a rainbow it will always have the colors from top to bottom: Red; orange; yellow; green; blue; indigo; violet If we look at these individual rings, ...
12
votes
11answers
1k views

Codegolf Rainbow : Fun with Integer-Arrays

Introduction: (Source: Wikipedia) When we look at a rainbow it will always have the colors from top to bottom: Red; orange; yellow; green; blue; indigo; violet If we look at these individual rings, ...
34
votes
23answers
7k views

Count Like a Babylonian

Challenge Given an ASCII representation of a Babylonian number as input, output the number in Western Arabic numerals. Babylonian Numeral System How did the Babylonians count? Interestingly, they ...
20
votes
11answers
2k views

A knight's graph on an N-by-N board

In chess, a knight can only move to the positions marked with X relative to its current position, marked with ♞: A Knight's Graph is a graph that represents all legal moves of the knight chess piece ...
21
votes
17answers
1k views

RTA (Reverse-Then-Add) root of a number

The reverse-then-add (RTA) sequence is a sequence obtained by adding a number to its reverse, and repeating the process on the result. For eg., $$ 5 + 5 = 10 \Rightarrow 10 + 01 = 11 \Rightarrow 11 +...
-3
votes
1answer
127 views

number decomposition [duplicate]

It's been a while since I posted here, so here we go another day another challenge. Challenge : Given a number(n) split it into it's prime factors. Input : A ...
14
votes
8answers
2k views

crossed out 44 is still regular 44 ;(

Introduction On March 24th, 2015 @isaacg golfed his Pyth answer from 44 to 42 bytes. Since a crossed out 44 (44) looks a lot like a regular 44, @Optimizer made the following comment: striked out ...
0
votes
1answer
110 views

Symmetric Numbers [duplicate]

write a function to tell if a number is symmetric or not. for example: input: 151 output: True input: 142 output: False and so on: 1111 True, 2390 False, 1226221 True
12
votes
14answers
2k views

Naismith's rule

Naismith's rule helps to work out the length of time needed for a walk or hike, given the distance and ascent. Given a non-empty list of the altitude at points evenly spaced along a path and the ...
15
votes
16answers
5k views

Is the bus load legal?

I was in the bus today, and noticed this sign: ...
28
votes
77answers
13k views

Is this number evil?

Introduction In number theory, a number is considered evil if there are an even number of 1's in its binary representation. In today's challenge, you will be identifying whether or not a given number ...
15
votes
25answers
2k views

Mixed Fraction Equality

In elementary school, children learn about proper fractions, where the numerator is less than the denominator, and thus the value of the fraction is less than one. Later, they are taught about ...
18
votes
29answers
2k views

Count the lucky tickets within the given range

In Russia we have something like a tradition: we like to look for lucky tickets. Here's what a regular ticket looks like: As you can see, the ticket has a six-digit number. A six-digit number is ...
17
votes
54answers
5k views

Sort odd numbers first

Rearrange a given list such that all the odd numbers appear before all the even numbers. Besides for this requirement, the output list may be in any order. The input will only contain integers, but ...
19
votes
17answers
1k views

Find The Sum of the First n Bouncy Numbers

Terminology An increasing number is one where each digit is greater than or equal to all the digits to the left of it (ex. 12239) A decreasing number is one where each digit is less than or equal to ...