# Questions tagged [number]

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

1,300 questions
Filter by
Sorted by
Tagged with
2k views

### Even or odd: three player

It's a three players game, play with one hand. At same time, each player show his hand with 0 to 5 fingers extended. If all player show same kind of (even or odd) number, there is no winner. But ...
16k views

### Count up forever

Write a program that counts up forever, starting from one. Rules: Your program must log to STDOUT or an acceptable alternative, if ...
827 views

### How Many Paint Tins Do I Need?

Task Take in 3 inputs. The length of the wall, the height of the wall and the coverage of the paint. Output how many tins of paint are required. Output Since there's no way to purchase ...
177 views

### Convert real numbers between factoradic and positive integer bases

This prompt asked you to convert back and forth to factoradic, but is very limited in scope (only decimal integers from 0 to 10!-1). Your task in this challenge is to reach just a bit further and ...
4k views

### German pharmacy payment

Your task is to calculate the amount you have to pay for prescribed medication at a pharmacy in Germany. The amount is simply based on the full price of the item, which will be your input. It is a ...
17k views

### Sum of all integers from 1 to n

I'm honestly surprised that this hasn't been done already. If you can find an existing thread, by all means mark this as a duplicate or let me know. Input Your input is in the form of any positive ...
11k views

### Determine if all decimal digits are unique

Deleted questions on Stack Overflow sometimes make for great golf material. Write a function that takes a nonnegative integer as input, and returns true if all the digits in the base 10 ...
8k views

### I reverse the source code, you negate the input!

Blatant rip-off of a rip-off. Go upvote those! Your task, if you wish to accept it, is to write a program/function that outputs/returns its integer input/argument. The tricky part is that if I ...
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>, <...
1k views

### Golf me the Schlosberg Numbers

Schlosberg Numbers In issue 5 of Mathematical Reflections, Dorin Andrica proposed the problem of characterising the positive integers n such that is an even integer. Eight people submitted ...
9k views

### Covering a Skyline with brush strokes

Given a non-negative integer skyline height list, answer how many uninterrupted 1-unit-high horizontal brush strokes are needed to cover it. [1,3,2,1,2,1,5,3,3,4,2]...
3k views

### Implement a whitespace golfer

Some two-dimensional esolangs, such as Forked, and some non-esolangs, such as Python, can sometimes require spaces before lines of code. This isn't very golfy. Also, I'm lazy and writing a 2d lang ...
2k views

### Landmine Number I

Background You have been given the task of calculating the number of landmines in a field. You must calculate the landmine score given a list/string of numbers and the landmine number. The landmine ...
3k views

### Say What You See

The "Look and say" or "Say what you see" sequence is a series of numbers where each describes the last. ...
1k views

### Find the indices of values in one list in another

You must take two lists of positive integers as input, let's call these n and m. You may assume that: All integers in n are part of m All integers in m are unique The lists are non-empty Challenge:...
5k views

### Is it a whole number?

A number is whole if it is a non-negative integer with no decimal part. So 0 and 8 and ...
8k views

### Is it a Cyclops number? "Nobody" knows!

Task: Given an integer input, figure out whether or not it is a Cyclops Number. What is a Cyclops number, you may ask? Well, it's a number whose binary representation only has one ...
3k views

### Create a checkerboard matrix

Take a positive integer n as input, and output a n-by-n checkerboard matrix consisting of 1 and 0. The top left digit should always be 1. Test cases: ...
18k views

### Is this number evil?

Introduction In number theory, a number is considered evil if there are an even number of 1's in its binary representation. In today's challenge, you will be identifying whether or not a given number ...
3k views

### Is it a Cyclic number?

A cyclic number is a number of "n" digits that when multiplied by 1, 2, 3,...n, results in the same digits but in a different order. For example, the number 142,857 is a cyclic number since ...
2k views

### How long is my number: Restricted Version

Find the original challenge here Challenge Given an integer, Z in the range -2^31 < Z < 2^31, output the number of ...
65k views

### Is this number a prime?

Believe it or not, we do not yet have a code golf challenge for a simple primality test. While it may not be the most interesting challenge, particularly for "usual" languages, it can be nontrivial in ...
6k views

### No strings (or numbers) attached

If you like this, consider participating in: The Official Dyalog APL 2016 Year Game The monthly Dyalog APL 2017 Code Golf Challenge Make 12 snippets/expressions, in the same language, that result in ...
14k views

### Is this relationship creepy?

According to this XKCD comic, there is a formula to determine whether or not the age gap in a relationship is "creepy". This formula is defined as: (Age/2) + 7 ...
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 ...
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$. ...
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 ...
6k views

### Increment an Array

Given a nonempty array of positive integers, "increment" it once as follows: If all the array elements are equal, append a 1 to the end of the array. For example: ...
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 ...
250 views

### It's Just Simple Math! [duplicate]

Task Your boss is on another crusade for 'efficiency.' He wants to encourage the use of numbers with fewer syllables, so that they're easier to discuss in meetings. If you want to take some time off ...
1k views

### Proper Divisor mash-up

A proper divisor is a divisor of a number n, which is not n itself. For example, the proper divisors of 12 are 1, 2, 3, 4 and 6. You will be given an integer x, x ≥ 2, x ≤ 1000. Your task is to sum ...
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 ...
651 views

### Generate Eban Numbers

(Continuing on the number sequences code-golf, here is an interesting sequence) Eban Numbers (A006933) are the sequence of numbers whose names (in English) do not contain the letter "e" (i.e., "e" is ...
748 views

### Calculate NDos-size of given integer

Objective Given a nonnegative integer, calculate its NDos-size as defined below, and output it. NDos' numeral system The concept of NDos-size comes from the numeral system I made. It represents every ...
7k views

### Notcalc (Calculate the wrong answer)

Goal: Given two natural numbers (integers from 0 to infinity), output a number that is not the sum of those numbers, but is a natural number. Example solutions (TI-Basic): ...
2k views

### Fractal Smoke Sequence

Introduction A229037 has a quite intriguing plot (at least for the first few terms): There is the conjecture, that it might indeed have some kind of fractal property. How is this sequence ...
5k views

### Generate Monday Numbers

Monday numbers, as defined by Gamow in this question over on Puzzling, are positive integers N with the following three properties: The decimal representation of N does not contain the digit 0 The ...
4k views

### Is it a Lynch-Bell number?

You will be given a positive, whole number (that will never contain a 0) as input. Your task is to check whether it is a Lynch-Bell number or not. A number is a Lynch-Bell number if all of its digits ...
2k views

### Diagonal Binary Sequence

Challenge: Given a positive number $n$, convert it to binary, and output a sequence where all 1s form a top-left to bottom-right diagonal line, including a ...
7k views

### Is the number binary-heavy?

An integer is binary-heavy if its binary representation contains more 1s than 0s while ignoring leading zeroes. For example 1 is ...
8k views

### Am I an insignificant array?

An insignificant array is an array of positive integers, where the absolute differences between consecutive elements are all smaller than or equal to 1. For example, the following array is ...
4k views

### American odds to probabilities

American odds (aka moneyline odds) are numbers like $+150$ or $-400$ used to express how much a winning bet would pay out. Convert odds to a fair win probability like this: Positive odds $+n$ ...
1k views

### Filter out and add up

Task The task is very simple. Given a non-empty string containing numbers, uppercase and lowercase letters, output the sum of the remaining numbers. For example: ...
4k views

You will be given two arrays of floating-point numbers. Your task is to pair the corresponding elements of the two arrays, and get the maximum of each pair. However, if the two corresponding elements ...
3k views

### Sort by Multiplying

You should write a program or function that given a list of positive integers multiplies each element with the smallest positive integer possible to create a strictly increasing list. For example if ...
1k views

### Number of palindrome splits

In this task you will take as input a non-negative integer $n$, and output the number of pairs of non-negative integers $a,b$ such that both are palindromes*, $a \leq b$, and $a+b = n$. For ...
986 views

### Multibase Numbers

(Similar: Through the bases) Normally, our number system is base ten, with the digits 0123456789. However, we can increase or decrease the base count (so ...
737 views

### Make a Plain PIE!

(2 Jan 2018) Because of the winning criteria I am going to accept the Jelly answer, but I am also giving upvotes to all other answers which all use astounding methods as well Introduction There are ...
The round function in Python 3 will round values of the form $k+\frac{1}{2}$ (with $k$ being an integer) to the nearest even integer, which is apparently better ...