Questions tagged [number]

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

Filter by
Sorted by
Tagged with
13 votes
16 answers
3k views

Create a bingo card generator

Bingo Bingo is a numbers game where players match randomly drawn numbers to the numbers on their cards. Each bingo card is a square grid with 25 spaces, and the columns of the grid are labeled with ...
Stewie Griffin's user avatar
23 votes
34 answers
2k views

Shortest digid-app GetPercentageRounds function

Context So the Dutch "Ministerie van Binnenlandse Zaken en Koninkrijksrelaties" (NL) - "Ministry of the Interior and Kingdom Relations" (EN) recently released the source code of ...
Ron Sijm's user avatar
  • 361
13 votes
8 answers
1k views

Toggle some bits and get an actual square

Inspired by the title of the Toggle some bits and get a square challenge. In that challenge you output how many bits should be toggled, in order for the base-10 representation of the binary to become ...
Kevin Cruijssen's user avatar
17 votes
16 answers
731 views

Form a subset that is a continuous range

Given a list of lists of positive integers, output a subset of them so their union forms a continuous non-empty range with no numbers missing. For example, consider this input: ...
mousetail's user avatar
  • 11.8k
15 votes
23 answers
2k views

Find the first run of numbers summing to n

Given as input a positive nonzero integer n >= 10 and a sequence of digits 0-9 (which may be taken as a string or a list), ...
Ginger's user avatar
  • 5,420
16 votes
15 answers
1k views

Division between two strings

Inverse function of this challenge To (properly) multiply an string by an integer, you split the string into characters, repeat each character a number of times equal to the integer, and then stick ...
l4m2's user avatar
  • 20.6k
13 votes
10 answers
2k views

Round to nicer numbers

The standard way to round numbers is to choose the nearest whole value, if the initial value is exactly halfway between two values, i.e. there is a tie, then you choose the larger one. However where I ...
Wheat Wizard's user avatar
  • 96.5k
13 votes
8 answers
1k views

Calculate my income tax

Background Here in the UK1, these are the income tax rules: You get a personal allowance (untaxed) of up to £12,570: If you earn less than £100,000, you get the full £12,570 as personal allowance ...
The Thonnu's user avatar
  • 17.8k
13 votes
35 answers
736 views

Create \$n\$ sublists with the powers of two (1, 2, 4, 8, 16...)

Challenge: Given the input number n. It should give me nested sublists of n layers with the power of two numbers for each level. ...
U13-Forward's user avatar
  • 2,001
34 votes
57 answers
5k views

Sum every second digit in a number

I have a number like this: n = 548915381 The output should be the sum of every second digit of that number. In this case 26: ...
S-Flavius's user avatar
  • 459
12 votes
30 answers
2k views

Find the nth number where the digit sum equals the number of factors

(This is OEIS A057531.) Your task Given a positive integer, \$n\$, find the \$n\$th number where the digit sum equals the number of factors Explanation For example, let's take 22: Its factors are \$[1,...
The Thonnu's user avatar
  • 17.8k
15 votes
14 answers
1k views

1 to N column and row sums

Inspiration There is a problem on the most recent AMC 12B test, the one held on November 16, 2022, which goes like this: (AMC 12B 2022, Question 17) How many \$4\times4\$ arrays whose entries are \$0\...
Aiden Chow's user avatar
  • 12.7k
17 votes
17 answers
2k views

Number to letters

Your task Given a numerical string or integer \$\ge 0\$ (which may have leading zeros), convert it to letters using the below rules. Rules Loop through the digits: If the digit is ...
The Thonnu's user avatar
  • 17.8k
5 votes
21 answers
506 views

Iterate through addition of number sequence until a single digit [closed]

Challenge: With any given number that has multiple digits, every digit in the number needs to repeatedly be summed together until the sum is a single digit number. To make things interesting, if there'...
Larsenv's user avatar
  • 87
27 votes
12 answers
1k views

Increment, decrement, undo, peek

Write a program or function (hereafter "function") that returns or prints the source code of four new functions: Increment, decrement, undo, and peek. The initial function contains an ...
Jordan's user avatar
  • 9,726
11 votes
6 answers
435 views

Conversions Galore!

Imagine that there are \$n\$ different types of objects \$O_1,O_2,O_3,\ldots,O_n\$ and they each have a conversion factor \$k_1,k_2,k_3,\ldots,k_n\$. You can, for any \$1\le i\le n\$, convert \$k_i\$ ...
Aiden Chow's user avatar
  • 12.7k
7 votes
5 answers
861 views

Fastest Gematria calculator

Gematria is an ancient Jewish method to determine a numeric value of a letter sequence, using a fixed value for each letter. Gematria is originally applied to Hebrew letters, but for the context of ...
The Shwarma's user avatar
17 votes
11 answers
2k views

Numbers vs. Strings: Language fitness challenge

inspired by thejonymyster's idea Rules This challenge is about finding languages that are very suitable for one task but quite the opposite in the other. The two tasks share a theme, but Task 1 is ...
Bubbler's user avatar
  • 73.8k
13 votes
15 answers
2k views

Advanced Binary Number System

Your task is to write a program that calculates the amount of different ways to display any given whole positive number using the following rules: Meet the 'advanced binary system': Any whole positive ...
Squareoot's user avatar
  • 145
6 votes
14 answers
1k views

Number of ways to make an amount with coins

This is not a duplicate of Sum of combinations with repetition. This question considers 1+2 to be the same as 2+1. The other ...
The Thonnu's user avatar
  • 17.8k
12 votes
2 answers
754 views

Solving an easy Sudoku in increasing digit order

Introduction: I'm old-fashioned and still read a physical newspaper in the morning while eating my breakfast. Although I don't like Sudoku that much, I do solve the Light-complexity ones, which are ...
Kevin Cruijssen's user avatar
19 votes
25 answers
2k views

Carry-less sum given a base b

Given a list of positive integers \$\mathcal I=I_1,I_2,I_3,...,I_n\$ and a base \$b>1\$ return their "carry-less sum", i.e. represent \$\mathcal I\$ in base \$b\$ and sum digit-by-digit ...
loopy walt's user avatar
4 votes
5 answers
277 views

Rotatable numbers (Upside down) [duplicate]

Searching for rotatable numbers, like: 68089 If you consider numbers upside-down, 6 looks like ...
F. Hauri  - Give Up GitHub's user avatar
15 votes
20 answers
1k views

Cartesian - polar conversion couple

We don't have a challenge for conversion between Cartesian and polar coordinates, so ... The challenge Write two programs (or functions) in the same language: one that converts from polar to ...
Luis Mendo's user avatar
  • 104k
2 votes
0 answers
353 views

Decompose number N into the sum of three triangular numbers [closed]

It is known that any natural number can be decomposed into the sum of three triangular numbers (assuming 0 is triangular), according to Fermat's Polygonal Number Theorem. Your task is to come up with ...
Study's user avatar
  • 45
7 votes
5 answers
333 views

Generate number set with conditions using n numbers

Generate \$T=\{T_1,...,T_x\}\$, the minimum number of \$k\$-length subsets of \$\{1,...,n\}\$ such that every \$v\$-length subset of \$\{1,...,n\}\$ is a subset of some set in \$T\$ Here, \$n > k &...
2FaceMan's user avatar
  • 179
22 votes
45 answers
2k views

Shifted auto-sum

Let’s take a positive integer such as 123. We define the shifted auto-sum of this integer as follows: 123 has 3 digits. We thus consider 3 copies of 123. We stack ...
Fatalize's user avatar
  • 38.4k
19 votes
21 answers
2k views

Multiply numbers by their depth

Given a ragged list, we can define an element's depth as the number of arrays above it, or the amount that it is nested. For example, with the list ...
emanresu A's user avatar
  • 35.6k
24 votes
12 answers
3k views

Golf GitHub's Pager Logic

Background When searches return many pages of results, GitHub avoids cluttering their UI by eliding page links. Instead, their UI lets you select: Pages at the beginning of the results. Pages near ...
Jonah's user avatar
  • 33k
15 votes
16 answers
1k views

Implement Binary Exponentiation

Background In programming, there is a recursive algorithm called binary exponentiation, which allows for large integer powers to be calculated in a faster way. Given a non-zero base \$x\$ and a non-...
Aiden Chow's user avatar
  • 12.7k
16 votes
14 answers
969 views

Number of binary partitions

We all know that any positive integer can be represented as the sum of powers of two. This is how binary representations work. However there's not just one way to do this. The canonical method, ...
Wheat Wizard's user avatar
  • 96.5k
14 votes
16 answers
2k views

Bloons TD 6 Upgrade Paths

Background The monkeys need help organizing their defense and have asked you, Benjamin the code monkey, to create a program that will list all tower upgrade options. Each tower has three unique ...
qwr's user avatar
  • 11.5k
22 votes
22 answers
2k views

Decipher a squashed sequence

Given a string containing a sequence of ascending consecutive positive integers, but with no separators (such as 7891011), output a list of the separated integers. ...
pxeger's user avatar
  • 23.3k
13 votes
4 answers
472 views

Not-Roman-Numeral Addition

Write the shortest program or function that mimics the addition in this XKCD strip: Input Two positive decimal integers containing only the digits 150. Output The ...
bigyihsuan's user avatar
  • 8,618
32 votes
27 answers
6k views

Doing a little trolling with the microwave timer

Related Sometimes when I use my microwave, I do a little trolling and enter times such as 2:90 instead of 3:30 because they end ...
lyxal's user avatar
  • 32.1k
24 votes
25 answers
3k views

How far from binary?

Given a decimal integer n as input, output the smallest (in terms of absolute value) decimal integer m such that the absolute ...
Fatalize's user avatar
  • 38.4k
12 votes
17 answers
1k views

Extract the contained powers of two!

Take as input an integer in any reasonable format. Then, output all the proper sub-strings of the base-10 digits of that integer that are powers of two, in any reasonable format. Test cases ...
Qaziquza's user avatar
  • 1,623
37 votes
50 answers
5k views

Previous Fibonacci number

The sequence of Fibonacci numbers is defined as follows: \$ F_0 = 0 \\ F_1 = 1 \\ F_n = F_{n-1} + F_{n-2} \$ Given a Fibonacci number, return the previous Fibonacci number in the sequence. You do not ...
pxeger's user avatar
  • 23.3k
15 votes
28 answers
2k views

There's more than one way to skin a set

Given a set of positive integers \$ S \$, output the set of all positive integers \$ n \$ such that \$ n \$ can be made by summing a subset of \$ S \$ in more than one different way, i.e., that are ...
pxeger's user avatar
  • 23.3k
5 votes
19 answers
2k views

Palindromic Powers

Powers We define an important power as a number that can be represented as \$ x^y \$ where \$ x ≥ 2 \$ and \$ y ≥ 2 \$. Palindrome We define an ...
Number Basher's user avatar
21 votes
8 answers
3k views

ASCII-Art n'th Root

Challenge: Given two integers \$a\$ and \$b\$, with lengths \$A=length(a), B=length(b)\$, output an ASCII-art of the \$a^{th}\$ root of \$b\$, including the answer rounded to \$A\$ amount of decimal ...
Kevin Cruijssen's user avatar
14 votes
6 answers
692 views

Rounding a range

You have a line with two endpoints a and b (0 ≤ a < b) on a 1D space. When ...
xiver77's user avatar
  • 2,325
22 votes
9 answers
991 views

Sequence of integers not the sum of powers of earlier terms

Starting with 1, output the sequence of integers which cannot be represented as the sum of powers of earlier terms. Each previous term can be used at most once, and the exponents must be non-negative ...
ATO's user avatar
  • 420
14 votes
19 answers
1k views

Words with Easy Letters in a Word Search

Introduction: Apparently I keep coming up with word search related challenges lately. :) When I do the word search in the Dutch news paper, some words are very easy to find because they contain ...
Kevin Cruijssen's user avatar
16 votes
15 answers
1k views

Average-ignorant sets of integers

Recently a friend of mine posed the following: What subset of the integers satisfies the condition if distinct a and b are in the subset, their average is not in the subset? I know the set of non-0 ...
Binary198's user avatar
  • 523
9 votes
38 answers
3k views

Find the weight of five apples

Problem John bought 5 apples. You are given the weights of every group of four apples, and must then find the weights of the apples themselves. For example, if all apples without the first one weigh ...
Alex R.'s user avatar
  • 209
17 votes
17 answers
3k views

Numbers in 2050

It's 2050, and people have decided to write numbers in a new way. They want less to memorize, and number to be able to be written quicker. For every place value(ones, tens, hundreds, etc.) the number ...
Shiv's user avatar
  • 303
5 votes
6 answers
545 views

Batt to the Basics

One of your acquaintances has a hobby of making make-shift electrical gadgets using various types of batteries. However, since they're thrifty, they want to use as few batteries as possible for their ...
Sylvester Kruin - try Codidact's user avatar
13 votes
17 answers
1k views

The interstice of two binary numbers

Given two integers, compute the two numbers that come from the blending the bits of the binary numbers of equal length(same number of digits, a number with less digits has zeros added), one after the ...
LWS SWL's user avatar
  • 420
10 votes
8 answers
2k views

How many times do I break my own rule?

Introduction: In my recent Strikethrough the Word Search List challenge I mentioned the following: When I do the word-search puzzles, I (almost) always go over the words in order, and strike them ...
Kevin Cruijssen's user avatar

1
2
3 4 5
26