Questions tagged [number]

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

Filter by
Sorted by
Tagged with
14 votes
20 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 ...
user avatar
  • 18.2k
4 votes
18 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 ...
user avatar
20 votes
8 answers
2k 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 ...
user avatar
14 votes
6 answers
651 views

Rounding a range

You have a line with two endpoints a and b (0 ≤ a < b) on a 1D space. When ...
user avatar
  • 2,101
22 votes
9 answers
945 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 ...
user avatar
  • 411
12 votes
18 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 ...
user avatar
14 votes
13 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 ...
user avatar
  • 491
8 votes
35 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 ...
user avatar
  • 99
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 ...
user avatar
  • 303
5 votes
6 answers
534 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 ...
user avatar
14 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 ...
user avatar
  • 457
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 ...
user avatar
3 votes
9 answers
1k views

int, float or neither?

Given a string, determine if it is an int, a float or neither. Examples 123 - int 62727.0033 - float 644c.33 - neither Your code should output a different value depending on which it is. For example ...
user avatar
  • 179
22 votes
17 answers
939 views

Pairs of integers ordered by their exponentiation

Output the infinite list of pairs of integers (a, b), where both \$ a > 1 \$ and \$ b > 1 \$, ordered by the value of \$ a^b \$. When there are multiple pairs ...
user avatar
  • 18.2k
25 votes
27 answers
2k views

Fill in the next numbers

Given a list of integers, output a list where the \$ i \$th element of the list equals the first number in the input list which is \$ \ge i \$, until there are no such numbers. For example, if the ...
user avatar
  • 18.2k
14 votes
14 answers
989 views

Lexicographically Smallest Decreasing Integer Partition

For a given number n, output an strictly decreasing array whose sum is n and its lexicographical order is the smallest for any ...
user avatar
  • 3,031
8 votes
7 answers
489 views

Factorials of primes decomposition

You have to decompose a positive integer/fraction as a product of powers of factorials of prime numbers. For example ...
user avatar
  • 3,031
12 votes
11 answers
2k views

Output two numbers (Robbers' thread)

This is the robbers' thread to a cops-and-robbers challenge. Click the link to find the cops' thread. In the cops' thread of this challenge, answerers will be writing programs which output two ...
user avatar
  • 84.5k
23 votes
20 answers
2k views

Output two numbers (Cops' thread)

This is the cops' thread to a cops-and-robbers challenge. Click the link to find the robbers' thread. The challenge here is very simple. Create two programs of the same size, in the same language, ...
user avatar
  • 84.5k
17 votes
28 answers
1k views

Reversed Multiple Pair

Intro Two numbers are a reversed multiple pair if they satisfy the following property: $$ a\cdot b = \operatorname{reversed}( (a-1)\cdot b ) $$ Here, \$\operatorname{reversed}()\$ means to reverse the ...
user avatar
  • 3,053
11 votes
18 answers
817 views

Move to Right and left

Task Your task is to take an array of numbers as input, and produce a new one where each number has been shifted both right and left, leaving 0s if no number fills ...
user avatar
  • 2,493
6 votes
1 answer
188 views

Represent any integer with an expression that uses no digit besides '4' [closed]

Fourward (Introduction) I have an unhealthy obsession with the number 4. I love it so much, in fact, that seeing any other digit is frustrating to me. I therefour wish to create a 'Fourier ...
user avatar
-6 votes
4 answers
150 views

Indices of square numbers that are also pentagonal [closed]

First 15 numbers of the A046173: ...
user avatar
  • 3,031
23 votes
27 answers
2k views

Next Greater Number

Given an integer n, find the next number that follows the following requirements The next greater number is a number where each digit, from left to right, is ...
user avatar
  • 3,031
16 votes
13 answers
997 views

Number of complete rhyme schemes

A rhyme scheme is the pattern of rhymes at the end of the lines in a poem. They are typically represented using letters, like ABAB. We consider two rhyme schemes ...
user avatar
  • 18.2k
18 votes
1 answer
645 views

Largest SKI output in less than 200 combinators

The Challenge Create an terminating expression in SKI Combinator Calculus in less than 200 combinators (S, K, I) that reduces to the expression with the most combinators. There will be no limit on how ...
user avatar
  • 703
8 votes
17 answers
787 views

Minimum difference between cartesian product of 3 elements that add up to a certain number

Let's say I've got a list (or array) of: l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] I want to get the third Cartesian power of the above list, where we take every ...
user avatar
  • 1,099
21 votes
17 answers
855 views

Kolmogorov-simple numbers

If you visit Code Golf often, you may have heard of Kolmogorov complexity. It's usually defined as the amount of bytes required to express some string in a programming language. Here the Kolmogorov-...
user avatar
  • 6,645
29 votes
12 answers
1k views

Nth FizzBuzz Number

Introduction Everyone knows the FizzBuzz sequence. It goes something like this: 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz . . . In case you don't ...
user avatar
  • 3,053
28 votes
25 answers
2k views

Converge to a number

Your challenge is to, given a positive integer n, count up to each digit of it, giving the effect of converging on it. Basically, count up to the first digit of n by its place value (\$⌊\log_{10}\left(...
user avatar
  • 26.7k
16 votes
11 answers
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^...
user avatar
  • 18.2k
-1 votes
6 answers
221 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, ...
user avatar
  • 329
14 votes
21 answers
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 ...
user avatar
  • 11.1k
18 votes
15 answers
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 ...
user avatar
  • 62.1k
16 votes
19 answers
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 \...
user avatar
  • 6,449
1 vote
0 answers
83 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 ...
user avatar
  • 329
14 votes
13 answers
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 ...
user avatar
28 votes
48 answers
3k 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 ...
user avatar
59 votes
47 answers
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 ...
user avatar
  • 42.9k
10 votes
5 answers
575 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\$ ...
user avatar
  • 1,599
6 votes
16 answers
811 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 ...
user avatar
  • 1,682
20 votes
18 answers
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 ...
user avatar
  • 26.7k
11 votes
32 answers
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 ...
user avatar
  • 261
4 votes
3 answers
396 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 ...
user avatar
19 votes
10 answers
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, \...
user avatar
  • 99.3k
15 votes
10 answers
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 ...
user avatar
26 votes
13 answers
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 ...
user avatar
4 votes
9 answers
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 ...
user avatar
21 votes
16 answers
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 ...
user avatar
  • 1,921
29 votes
33 answers
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 ...
user avatar
  • 1,921

1
2 3 4 5
25