Questions tagged [number]

A competition to solve a particular problem through the usage and manipulation of numbers.

Filter by
Sorted by
Tagged with
22
votes
33answers
1k views

Apply at indices

Given: a blackbox function \$f : \mathbb N \to \mathbb N\$, a list of positive integers \$L\$, and a list of indices \$I\$, apply \$f(x)\$ to the elements of \$L\$ at the indices specified in \$I\$. ...
17
votes
8answers
2k views

What's my lucky factor?

Lucky numbers (A000959) are numbers generated by applying the following sieve: Begin with the list of natural numbers: ...
10
votes
21answers
3k views
+50

Exciting Mario Kart Grand Prix - Minimize the point difference!

Introduction When playing Mario Kart the other day, an interesting question popped up when a Grand Prix with my 2 roommates, 9 AI drivers and myself seemed to be fairly close and therefore exciting ...
7
votes
15answers
1k views

Base-ically god

Story The god of base is opening heaven’s gate for mortals to join the base party. You, as one of the believers, want to follow their steps to ascend to heaven. But not everyone can get in. The god ...
14
votes
19answers
2k views

Do I need a win streak?

You have played \$N\$ matches in some game where each match can only result in one of the two outcomes: win or loss. Currently, you have \$W\$ wins. You want to have a win percentage of \$P\$ or more, ...
19
votes
6answers
1k views

You are kinda Replacable to Me

You are provided with a non-empty array \$A\$ of integers, all greater than 0. But what good is an array if the elements do not sum up to the number \$N\$ (also provided as input)... So to change that,...
1
vote
4answers
201 views

A problem of rarity [closed]

Given a positive input \$n > 0\$, output the amout of two types based on their rarity. The two types are called \$A\$ and \$B\$, we know the followings: \$n\$ is a limited input and the maximum is ...
21
votes
20answers
2k views

Code the Levine sequence

Introduction Note that I learned it from a Numberphile Video, where Neil Sloane explains it better. I recommend you to watch his Video. But for a quick Introduction: The Levine Sequence is made from ...
25
votes
30answers
4k views

Count all possible Tweets

Challenge This challenge is pretty simple: Output the total number of possible Tweets. Given the fact that \$1114112\$ Unicode characters exist, and Tweets can be up to \$280\$ characters long, we ...
24
votes
10answers
1k views

Unique half rainbows

If we take a positive integer \$n\$ and write out its factors. Someone can determine \$n\$ just from this list alone. In fact it is trivial to do this since the number is its own largest factor. ...
18
votes
16answers
2k views

Self-Replicating Numbers

Background For the purpose of this challenge, all numbers and their string representations are assumed to be in decimal (base 10). I tried to find proper terminology for this challenge, but I do not ...
15
votes
30answers
849 views

Largest power of 2 that divides \$n\$

Related, related Introduction The ruler sequence is the sequence of the largest possible numbers \$a_n\$ such that \$2^{a_n}\mid n\$. It is so-called because its pin plot looks similar to a ruler's ...
12
votes
17answers
901 views

Liars and Guessers

Github You have probably played, and may even have written a program to play, a simple number guessing game. If so, this probably looks familiar: ...
0
votes
8answers
928 views

Let's rise higher [closed]

Challenge The main objective of the challenge is pretty simple, this is an answer chaining contest, where you have to serially print numbers from 1. That means User 1's answer will print ...
29
votes
24answers
2k views

First sequence with no square differences

Consider the sequence \$(a_n)\$ defined in the following way. \$a_0=0\$ For all \$n=1, 2, 3, \dots\$, define \$a_n\$ to be the smallest positive integer such that \$a_n-a_i\$ is not a square number, ...
23
votes
34answers
2k views

Remove excessive occurrences

Given an array \$A\$ of positive integers between \$1\$ and \$9\$ inclusive and a positive integer \$n\$, remove all integers in \$A\$ which appear more than \$n\$ times. For example: ...
34
votes
97answers
10k views

Print 0 to 100 without 1-9 characters

Print 0 to 100 without using characters 1,2,3,4,5,6,7,8,9 in your code. Seperator of numbers can be comma, whitespace or newline. Shortest code wins.
11
votes
4answers
670 views

Golf this Thumb-2 Constant!

One thing that is constantly frustrating when golfing ARM Thumb-2 code is generating constants. Since Thumb only has 16-bit and 32-bit instructions, it is impossible to encode every immediate 32-bit ...
46
votes
24answers
4k views

Ginormous number

Output this 1364-digit base-10 number: ...
15
votes
8answers
725 views

Close(st) Binary Boxes

Challenge: Given a list of non-negative integers, determine by how much you should increase each item to create the closest binary box with the resulting integer-list. What is a binary box? A binary ...
13
votes
21answers
1k views

Get the length of a Sumac Sequence

Heavily based on this closed challenge. Codidact post, Sandbox Description A Sumac sequence starts with two non-zero integers \$t_1\$ and \$t_2.\$ The next term, \$t_3 = t_1 - t_2\$ More generally, \$...
15
votes
14answers
1k views

Split a number in every way possible way within a threshold

Task Given a positive integer number and a threshold, split into every possible way without generating any numbers above the threshold. Examples Input: 15008 Threshold: 400 Valid Output: ...
4
votes
5answers
198 views

Strobogrammatic Numbers [duplicate]

Strobogrammatic Numbers Definition A number which is rotationally symmetrical, i.e., it'll appear the same when rotated by 180 deg in the plane of your screen. The following figure illustrates it ...
20
votes
25answers
1k views

Possible binaries sum

This challenge is inspired by the AoC 2020, Day 14 - Part II, created by Eric Wastl and his team, which asks to output the possible binary values from a bitmask. Let's say we've a bitmask like ...
23
votes
3answers
653 views

Towering Cistercian representation

SE Sandbox Link, Codidact Sandbox Link Inspired by this video. Given a positive integer, draw its Cistercian representation as ascii art. The Challenge Cistercian numerals are a decimal-based number ...
26
votes
17answers
3k views

Convert negadecimal to decimal (and back)

Negadecimal, also known as base -10, is a non-standard positional numeral system. Take the number \$1337_{10}\$. In decimal, this has the value one thousand three hundred thirty seven, and can be ...
10
votes
7answers
2k views

Fastest square root of an arbitrary size

We do seem to have a fastest square root challenge, but it's very restrictive. In this challenge, your program (or function) will be given an arbitrarily sized nonnegative integer, which is the square ...
19
votes
32answers
2k views

Make a minimal and maximal 2-digit number from digits of two 3-digit numbers

Let's solve this user's homework; I think it's an interesting exercise! Input Two 3-digit natural numbers. Outputs Two 2-digit numbers. In each of the output numbers, one digit is taken from one input ...
11
votes
14answers
864 views

Prefix divisibility

Inspiration Given a positive integer \$1 \le n \le 9\$, output all positive \$n\$-digit integers \$i\$ for which the following is true: Each digit from \$1\$ to \$n\$ appears exactly once in \$i\$. ...
-1
votes
1answer
182 views

Square root of a base 10 positive integer, digit by digit [closed]

It is possible (Wikipedia reference) to compute the square root of any number in a digit by digit fashion using a simple (I had learned it in primary school) algorithm. Challenge: read a positive ...
10
votes
14answers
425 views

Golf a bijection \$\mathbb{N}^n\to\mathbb{N}\$

Your task is to write a program which implements a bijection \$\mathbb{N}^n\to\mathbb{N}\$ for \$n \ge 1\$. Your program should take \$n\$ natural numbers as input, in any acceptable method (including ...
22
votes
9answers
1k views

Count the Collatz survivors mod 2^n

Introduction We have 22 Collatz conjecture-related challenges as of October 2020, but none of which cares about the restrictions on counter-examples, if any exists, to the conjecture. Considering a ...
14
votes
8answers
2k views

We're much closer than you think

Martin Ender's 2D programming language Alice has two different modes depending on what orientation the IP has: orthogonal (Cardinal mode) or diagonal (Ordinal mode). Commands in Alice change their ...
22
votes
18answers
2k views

Eating Persistence

Intro Find the result of number cannibalism. Why was 6 scared of 7? Becase 7 8 9. Your program will have to find the result of applying the ...
19
votes
16answers
2k views

Size up a number

Intro Given a whole number \$< 100,\$ extend/shorten the english representation of the number to have as many characters as it's value. Sandbox Rules Take the number \$n\$, and get it in words ...
11
votes
1answer
397 views

Amount Of Potential Keys That'll Fit The Lock

Introduction: You're a key maker, and want to access something from a safe that has a lock. Unfortunately, the key to that lock is lost, so you'll have to make a new one. You have access to a bunch of ...
19
votes
14answers
1k views

sporeball numbers

Background We've studied at least five different types of numbers based on the IDs of different users on this site. Why not study another? My user ID is \$91030_{10}\$. Its binary representation is \$...
13
votes
13answers
1k views

Diophantine Approximation: find lowest possible denominator to approximate within given precision

Challenge Given a number x and a precision e, find the lowest positive integer q such that <...
17
votes
12answers
2k views

Implement the Polygamma function

The Polygamma function of order \$m\$, \$\psi^{(m)}(z)\$, is the \$(m + 1)\$th derivative of the logarithm of the gamma function, which is also the \$m\$th derivative of the digamma function. Your ...
-6
votes
13answers
277 views

Number chopping: Split a number into its digits [closed]

Number Splitting Instructions Oh no, my numbers have stuck together! Luckily, we can split them apart with code. Your code should be a function that takes an integer input from stdin or as an argument....
29
votes
36answers
3k views

Rotate a number

Given a positive number n, rotate its base-10 digits m positions rightward. That is, output the result of ...
9
votes
14answers
813 views

Descending dungeons of positional systems

The sequence discussed in this challenge is a variant of the Descending Dungeons sequence family. Specifically, the sequence generation rules: ...
35
votes
50answers
4k views

How many 1's we get

Description Count how many occurrences there are of the digit 1 between two given numbers \$[a, b]\$, inclusive. For example, from 1 to 100 it should be 21: 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,...
8
votes
7answers
2k views

Music with pi and e

Because I forgot to celebrate Pi Day (14.3), let's celebrate with \$\pi\$, \$e\$ (Euler's number) and music! Challenge No, we don't have time to eat a pi-pizza, let's make a program. What you need is ...
5
votes
8answers
262 views

Is it a geometric sequence or not? [closed]

Well, last time I asked for an arithmetic sequence, now comes the geometric sequence Challenge In this challenge, the input will be an unordered set of numbers and the program should be able to tell ...
-7
votes
4answers
220 views

Is it an Arithmetic Sequence or not? [closed]

Challenge In this challenge, the input will be an ordered set of numbers and the program should be able to tell if the set of numbers is an Arithmetic Sequence. Input The input will be a list ...
13
votes
18answers
1k views

Name the Aztec year

It's time for another Mesoamerican calendar! The Xiuhnelpilli was used by the Aztecs (more properly, the Mexica) to name their years. Each year has a number and a sign. Here's part of the cycle: <...
2
votes
3answers
463 views

Checking a Windows 95 OEM Key for validity [closed]

Introduction Windows 95 used a very simple algorithm for verifying license keys. The scheme of an OEM license key always looked like this: xxxyy-OEM-NNNNNNN-zzzzz ...
17
votes
11answers
2k views

The Double-Castle Numbers™

Introduction A double-castle number™ is a positive integer number that has a pattern of $$\underbrace{a\cdots a}_{m\text{ }a\text{s}}b\underbrace{a\cdots a}_{m\text{ }a\text{s}}b\underbrace{a\...
42
votes
5answers
4k views

Compute xkcd's Wrong Times Table

The 2020-05-29 xkcd comic showed us the numbers that Randall Munroe feels would be most likely to result from multiplication, other than the correct answers. The table does seem to have some sort of ...

1
2 3 4 5
23