Questions tagged [number]

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

Filter by
Sorted by
Tagged with
21 votes
9 answers
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: ...
caird coinheringaahin g's user avatar
11 votes
21 answers
3k views

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 ...
Der_Reparator's user avatar
8 votes
17 answers
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 ...
okie's user avatar
  • 1,807
15 votes
21 answers
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, ...
Manish Kundu's user avatar
  • 5,260
21 votes
6 answers
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,...
Manish Kundu's user avatar
  • 5,260
1 vote
4 answers
218 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 ...
G. Ciardini's user avatar
22 votes
20 answers
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 ...
math scat's user avatar
  • 8,463
27 votes
31 answers
4k views

Count all possible Tweets

Challenge This challenge is pretty simple: Output the total number of possible Tweets. Given the fact that \$1{,}114{,}112\$ Unicode characters exist, and Tweets can be up to \$280\$ characters long, ...
Makonede's user avatar
  • 6,465
28 votes
12 answers
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. ...
Wheat Wizard's user avatar
  • 96.5k
19 votes
16 answers
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 ...
Zaelin Goodman's user avatar
17 votes
32 answers
2k 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 ...
Makonede's user avatar
  • 6,465
16 votes
17 answers
1k 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: ...
Miriam's user avatar
  • 843
-3 votes
8 answers
993 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 ...
Wasif's user avatar
  • 12.3k
30 votes
24 answers
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, ...
79037662's user avatar
  • 2,979
26 votes
36 answers
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: ...
caird coinheringaahin g's user avatar
66 votes
170 answers
16k views

Print 0 to 100 without 1-9 characters

Print integers 0 to 100 (inclusive) without using characters 123456789 in your code. Separator of numbers can be comma or white space (by default <blank>, <...
user avatar
15 votes
6 answers
838 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 ...
EasyasPi's user avatar
  • 4,750
47 votes
24 answers
5k views

Ginormous number

Output this 1364-digit base-10 number: ...
xnor's user avatar
  • 144k
16 votes
8 answers
769 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 ...
Kevin Cruijssen's user avatar
19 votes
24 answers
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, \$...
Razetime's user avatar
  • 27k
15 votes
14 answers
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: ...
DanielMK's user avatar
  • 253
4 votes
5 answers
357 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 ...
vrintle's user avatar
  • 2,970
22 votes
25 answers
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 ...
vrintle's user avatar
  • 2,970
23 votes
3 answers
727 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 ...
Razetime's user avatar
  • 27k
26 votes
17 answers
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 ...
Rydwolf Programs's user avatar
12 votes
7 answers
3k 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 ...
Rydwolf Programs's user avatar
20 votes
34 answers
3k 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 ...
anatolyg's user avatar
  • 13.1k
11 votes
14 answers
892 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\$. ...
caird coinheringaahin g's user avatar
-1 votes
1 answer
221 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 ...
gboffi's user avatar
  • 115
10 votes
14 answers
652 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 ...
caird coinheringaahin g's user avatar
23 votes
9 answers
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 ...
Shieru Asakoto's user avatar
14 votes
9 answers
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 ...
caird coinheringaahin g's user avatar
22 votes
18 answers
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 ...
Razetime's user avatar
  • 27k
19 votes
16 answers
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 ...
Razetime's user avatar
  • 27k
11 votes
1 answer
434 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 ...
Kevin Cruijssen's user avatar
20 votes
14 answers
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 \$...
sporeball's user avatar
  • 1,656
13 votes
13 answers
2k 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 <...
Stef's user avatar
  • 569
17 votes
12 answers
3k 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 ...
caird coinheringaahin g's user avatar
-7 votes
13 answers
760 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....
Pinrui Huang's user avatar
35 votes
44 answers
4k views

Rotate a number

Given a positive number n, rotate its base-10 digits m positions rightward. That is, output the result of ...
a1426's user avatar
  • 459
9 votes
14 answers
824 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: ...
AndrewTheCodegolfer's user avatar
36 votes
51 answers
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,...
Chau Giang's user avatar
  • 1,267
9 votes
8 answers
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 ...
math scat's user avatar
  • 8,463
5 votes
8 answers
282 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 ...
math scat's user avatar
  • 8,463
-8 votes
4 answers
253 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 ...
math scat's user avatar
  • 8,463
13 votes
18 answers
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: <...
KeizerHarm's user avatar
  • 1,171
2 votes
3 answers
2k 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 ...
CocoaBean's user avatar
  • 359
17 votes
11 answers
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\...
Shieru Asakoto's user avatar
42 votes
5 answers
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 ...
Aaron Rotenberg's user avatar
26 votes
19 answers
2k views

Bubbler numbers

Background My user ID is 78410, or \$1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 1 0_2\$. One interesting property of this number is that, in binary, it doesn't have three consecutive identical digits, and yet it ...
Bubbler's user avatar
  • 73.8k

1 2 3
4
5
26