# Questions tagged [number]

This challenge is intended to be solved by using, manipulating, accepting as input, or outputting numeric values.

978 questions
2k views

### Determining the continued fractions of square roots

The continued fraction of a number n is a fraction of the following form: which converges to n. The sequence ...
301 views

### All non-empty finite sets of positive integers

The challenge is to create an iterator(/generator) which iterates (in any order so as to reach all of them... ie no set should occur at infinity) over all possible non-empty finite sets(/tuples/lists) ...
1k views

### Implementing Binary Arithmetic

Given two binary numbers (strings containing 0s and 1s), perform operations on them, with one problem: You must keep them in binary. That means no going ...
813 views

### Range of numbers

Came over a similar problem in a project I'm working on and found it quite hard to solve it without excesive use of if. I'm eager to see if anyone can come up with ...
3k views

### add commas to Numbers without String manipulation

This challenge consist in adding commas to numbers every 3 spaces like: 123456789 => 123,456,789 Specifications: The ...
10k views

### Random sampling without replacement

Create a function that will output a set of distinct random numbers drawn from a range. The order of the elements in the set is unimportant (they can even be sorted), but it must be possible for the ...
12k views

### Outputting ordinal numbers (1st, 2nd, 3rd)

I would like to generate (as a return result of a function, or simply as the output of a program) the ordinal suffix of a positive integer concatenated to the number. Samples: ...
2k views

### Finding Not-Quite-Prime Numbers

Your challenge, should you chose to accept it, is to code-golf a function that returns true or false (or some similar meaningful representation of yes and no) if a number meets the following criteria: ...
3k views

### determine longest group of consecutive numbers

INPUT: 10 random numbers each number is greater than 0 and less than 100 list of numbers is presorted, lowest to highest the list will not contain any duplicate numbers CHALLENGE: Write a function ...
664 views

### The group of sequential positive numbers with the highest sum?

Given the following list of numbers, find the group of sequential positive numbers with the highest sum. Example input: 12 2 35 -1 20 9 76 5 4 -3 4 -5 19 80 32 -1 ...
4k views

### Print the amount of ones in a binary number without using bitwise operators

Description Given a number, print the amount of 1s it has in binary representation. Input A number >= 0 in base 10 that ...
891 views

### position of the only 1 in a number in binary format [closed]

Every number of the form 2i (where i is a non-negative integer) has a single 1 in its binary representation. Given such a number, output the 1-based position of the ...
2k views

Read input of up to 8 characters presented as hexadecimal number and print this number as decimal number. In case that input can not be presented as hexadecimal input it has to print 0 Rules: It is ...
3k views

### Enumerate all palindromic numbers (in decimal) between 0 and n

Given a non-negative integer n, enumerate all palindromic numbers (in decimal) between 0 and n (inclusive range). A palindromic number remains the same when its digits are reversed. The first ...
1k views

### Machine Epsilon

Machine epsilon is an important floating point number to know when doing numerical calculations. One way to understand it is when this relation ...
14k views

### Shortest way to reverse a number

Write a function (or equivalent subprogram) to accept a single integer valued argument and return a (similarly typed) value found by reversing the order of the base-10 digits of the argument. For ...
525 views

### Formatting numbers

Today computers use millions of bytes of memory, and decimal or hexadecimal notations get less and less informative. Most human-readable formatting just display the number with the highest unit ...
533 views

### The Prime Grid Game

I had fun solving this, so I offer this golf challenge. The objective of this golf is to find the largest prime number that can be constructed using the given instructions. You should accept 3x3 ...
1k views

### Amicable number calculator

Write a program that calculates amicable numbers, starting from [0,0], intil the maximum value for an integer is reached in the language you chose to write it in. Amicable numbers are two different ...
4k views

### Arbitrary Base Conversion [closed]

Create a routine that takes an array of blocks in one numeric base system, and convert them to an array of blocks in another numeric base system. Both the from and to systems are arbitrary and should ...
813 views

### Floating point addition, without floats!

Your task is to write a program, in any language, that adds two floating point numbers together WITHOUT using any fractional or floating point maths. Integer maths is allowed. Format The format for ...
265 views

### Power modulo golf. [closed]

Write a function f(a,b,c) that calculates a^b (mod c) in less than 10 seconds. a, b < 10^100 c < 10000. examples: ...
2k views

### Calculate the last digits of Graham's Number

Graham's number ends in a 7. It is a massive number, in theory requiring more information to store than the size of the universe itself. However it is possible to calculate the last few digits of ...
617 views

### Output nearby primes

Write a program which takes an input (which may or may not be prime), and lists the immediate prime following and preceding it. Example input: 1259 Example ...
413 views

### Perfect powers in more than one way?

Challenge Your task is to write a program or function which, given a positive integer N, finds all positive integers less than or equal to N that can be expressed as a perfect power in more than one ...
403 views

### Minimum of last k

Write a function that takes two arguments: a number k and a list l, and that returns another list ...