Questions tagged [number]

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

Filter by
Sorted by
Tagged with
15
votes
11answers
2k views

Write a number in overflowed binary

We all know how binary conversion works: the sequence of bits $$ b_1, b_2, ..., b_{n-1}, b_n $$ encodes the number $$ b_1 \times 2^{n-1} + b_2 \times 2^{n-2} + ... + b_{n-1} \times 2^1 + b_n \times 2^...
-1
votes
6answers
212 views

Check for Wonky numbers [closed]

Task : Wonky numbers are 3-or-more digit numbers that meet one or more of the following criteria: Any digit followed by all zeros: 100, ...
13
votes
21answers
2k views

Constructing Solar Panels from Squares

I'm designing a new space station for generic super-villain purposes (something something megalaser), but I'm having trouble designing the solar panels. My genius team of scientists can calculate ...
18
votes
15answers
1k views

Verb arities in J trains

Background J has trains similar to APL's. Given a sequence of verbs (functions), three rightmost verbs are grouped to form a derived verb (a fork) recursively, until one or two verbs remain. If the ...
13
votes
19answers
1k views

Find the k-th order summary of a number

Background The summary of a non-negative integer \$n\$ is the concatenation of all digits that appear in \$n\$ in increasing order, with each digit being preceded by the number of times it appears in \...
1
vote
0answers
79 views

Make me equal to 24 [duplicate]

Based on this game. Description : Based on Wikipedia's description. The 24 Game is an arithmetical card game in which the objective is to find a way to manipulate four integers so that the end result ...
13
votes
13answers
2k views

Find the smallest solution for this simple equation

Input 4 integers w, x, y, z from the range -999 to 999 inclusive where none of the values is 0. Output 4 integers a, b, c, d so that aw + bx + cy + dz == 0 where none of the values is 0. Restrictions ...
26
votes
47answers
2k views

Swap Two Values in a List

Introduction: Although we have a lot of challenges where swapping two items in a list is a subtask, like Single swaps of an array; Swap to Sort an Array; \$n\$ swaps into a nop; etc., we don't have ...
56
votes
47answers
8k views

Increment The Time

Every digital clock contains a small creature that has to advance the time every minute [citation needed]. Due to the popularty of digital clocks and the popularity of catching them in the wild, they ...
10
votes
5answers
555 views

Khinchin's constant bad estimate [closed]

Inspired by How to write down numbers having an infinity of decimals? Link 🇫🇷 Background From Wikipedia: for almost all real numbers \$x\$, coefficients \$a_i\$ ...
4
votes
16answers
799 views

Written Word Equation

Word equations, but not as you know it! Given a sentence which will include two numbers, numerically, and a spelt operator, in the order seen in the examples, your goal is to give the numerical answer ...
19
votes
18answers
2k views

Adaptive randomisation

Given a number \$n ≥ 2\$, a blackbox function \$f\$ that takes no arguments and returns a random integer in the range 0...n-1 inclusive, and a number \$m ≥ n\$, your challenge is to generate a random ...
10
votes
32answers
1k views

Index and return 3 characters

The challenge is simple: Read 3 letters from a system input¹ and convert them to numbers (A-1, B-2, C-3...Z-26)². Print each of those numbers in the order the ...
4
votes
3answers
389 views

Will the hydra finally die? Part II

Background This is a follow up question to the question: Will the Hydra finally die? As before a dangerous A Medusa have released a dangerous Hydra which is revived unless the exact number of heads it ...
19
votes
10answers
1k views

Ploughed fields via moduli

Let \$R, C\$ be positive integers and let \$0 < s \leq 1\$. Consider the \$R \times C\$ matrix \$\mathbf M\$ defined as \begin{equation} M(i,j) = \frac{\mathrm{mod}\,(j, i^s)}{R^s}, \quad i = 1, \...
15
votes
10answers
3k views

Project Euler 1: Multiples in constant time

The purpose of this challenge is to solve the original first Project Euler problem, but as the title suggests in constant time (with respect to the size of the interval). Find the sum of all the ...
21
votes
12answers
2k views

Is it a Giuga number?

Giuga numbers (A007850) are composite numbers \$n\$ such that, for each prime factor \$p_i\$ of \$n\$, \$p_i \mid \left( \frac n {p_i} -1 \right)\$. That is, that for each prime factor \$p_i\$, you ...
4
votes
9answers
2k views

Will the Hydra finally die?

Background A Medusa have released a dangerous Hydra which is revived unless the exact number of heads it have is removed. The knights can remove a certain number of heads with each type of attack, and ...
20
votes
16answers
2k views

Largest Number with No Repeating Digit Pairs

Inspired by the problem with the same name on Puzzling SE by our very own Dmitry Kamenetsky. You are to find the largest number that only uses every digit pair once, in a given base. For example, in ...
28
votes
33answers
2k views

Mr. Binary Counterman

Mr. Binary Counterman, son of Mr. Boolean Masker & Mrs. Even Oddify, follows in his parents’ footsteps and has a peculiar way of keeping track of the digits. When given a list of booleans, he ...
25
votes
12answers
2k views

Collatz's ice cream cone factory

The Collatz sequence Given a positive integer \$a_1\$, the Collatz sequence with starting value \$a_1\$ is defined as \begin{equation} a_{n+1} = \begin{cases} a_n/2 & \mathrm{if}\ a_n\ \mathrm{is}\...
7
votes
10answers
592 views

A triangle of numbers

Challenge Make a triangle of numbers like below. How to? Let say we get a numbers in the form of ab, for example 12. We then create a triangle like below: Sorry ...
10
votes
13answers
700 views

'Plane' the numbers in any base!

Inspired by this Numberphile video. What is planing? In order to 'plane' a sequence of digits, you need to: Identify the lengths of the 'runs' (adjacently repeated digits) in the sequence. Non-...
11
votes
7answers
749 views

Prime Factorization - but on the exponents too

Though there is a prime factorization challenge and it's here, this, I feel, will be a bit more interesting than that one. To understand this, let's have an example; I will use 5,184 for this. \$5184 =...
2
votes
3answers
539 views

Programming Less-Than, Greater-Than and Equal-To functions using Restricted Source [closed]

I'm currently working with a branchless language which does not have native Less-Than, Greater-Than or Equal-To functions. I do however have min, ...
7
votes
14answers
593 views

Calculate \$ \lfloor n \log_2(n) \rfloor \$, exactly

Given an integer \$ n \ge 2 \$, you need to calculate \$ \lfloor n \log_2(n) \rfloor \$, assuming all integers in your language are unbounded. However, you may not ignore floating-point errors - for ...
17
votes
9answers
1k views

Dimensional Chess positions

Task Any one of these two: Determine if a given position (an ordered non-empty collection of integers in the range ‒8 to 8, or ‒7 to 7 if you want) is a valid Dimensional Chess position. List all the ...
14
votes
15answers
1k views

Convert version string to pack_format

When making a Minecraft data/resource pack, you need to include a pack.mcmeta file, which specifies information about it. ...
11
votes
5answers
432 views

Set the sum and product

Given two positive reals \$a\$ and \$b\$, output some positive reals \$r_i\$, such that \$\sum r_i=a\$ and \$\prod\left(r_i+1\right)=b\$. You can assume that it's possible. You can also assume that ...
16
votes
3answers
569 views

Compute the uncomputable ... sort of

Implement a function \$f\$ (as a function or complete program), such that \$ \displaystyle\lim_{n\rightarrow \infty} f(n) \$ converges to a number which is not a computable number. Answers will be ...
5
votes
12answers
912 views

Base-ically Guard

Base: part 1 This is part 2, Strongly suggest you go try out the first one if you haven't tried it. Story As one of the solvers, You've managed to get to the door of the base heaven. In front of the ...
22
votes
33answers
2k 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\$. ...
19
votes
9answers
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

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 ...
8
votes
17answers
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
210 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 ...
27
votes
31answers
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
944 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
980 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: ...
-3
votes
8answers
957 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: ...
47
votes
127answers
13k 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
6answers
780 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: ...

1
2 3 4 5
24