Tagged Questions

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

learn more… | top users | synonyms

10
votes
4answers
764 views

Convert x-illion into standard form

Given a string, consisting of a prefix and then "illion", convert this number into standard form. For example: "million" -> 10^6 "trillion" -> 10^12 "quattuordecillion" -> 10^45 The ...
8
votes
4answers
295 views

Decompose a number into a sum of repdigits

Repdigits are numbers of the form a * (10^n - 1)/9 with a in [-9,9]\{0} (in other words 111, -3333, 66, numbers which are made by repeating only one digit) Goal: Write a program or function which ...
11
votes
7answers
968 views

Determine the Base that a Given Equation is True

Given 3 integers, determine the lowest possible base for the first two integers to multiply into the third. If you think of the Answer to Life, the World, and Everything, 6 * 9 == 42 is true in Base ...
3
votes
3answers
154 views

Number sum medley

Winner CJam, 74 bytes by Optimizer Task Take an input of an integer n through the console or a file. Find the sum of the nth prime, square, triangular number, and cube. Add to that the factorial ...
6
votes
14answers
2k views

Shrinking numbers

The input is an array of (at least 3, maximum 20) different integers. Each integer is greater than -1000 and smaller than 1000. Your task is to shrink the numbers by "linearly mapping" them from 0.0 ...
5
votes
4answers
616 views

Un-hash the Java Hash

Hash Un-hashing The basic goal of this challenge is to exploit the high probability of collision in the Java Hash function to create a list of plausible inputs that created an outputted hash. The ...
6
votes
12answers
735 views

Output all numbers below certain number containing certain digits

Output all numbers in certain range containing certain digits Task Take an input of digits through console, prompt, or a file (in the decimal number system). These digits should be separated by ...
7
votes
6answers
556 views

Mixed Base Conversion

Background Most people on here should be familiar with several base systems: decimal, binary, hexadecimal, octal. E.g. in the hexadecimal system, the number 1234516 would represent 1*16^4 + 2*16^3 + ...
14
votes
7answers
1k views

Countdown and recycle

Countdown Your goal for this code-golf challenge is to count down and meanwhile recycle numbers. Let me explain. First your application reads a number, either as program argument or using stdin. ...
23
votes
1answer
497 views

Standardise a Phinary Number

Background Most people on here should be familiar with a few integer base systems: decimal, binary, hexadecimal, octal. E.g. in the hexadecimal system, a number abc.de16 would represent a*16^2 + ...
7
votes
4answers
353 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 ...
12
votes
6answers
954 views

Integer Emotions

Write a program or function that "reacts" to a given integer n (input via function parameter/args/stdin) The program doesn't care about negative numbers, likes even, dislikes odd numbers and ...
13
votes
8answers
1k views

Generate Hofstadter's Figure-Figure Sequence

In Gödel, Escher, Bach, Douglas Hofstadter introduces an integer sequence which is commonly referred to as the figure-figure sequence: 2, 4, 5, 6, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22, ...
11
votes
11answers
2k views

What's that number in Shortlex?

Most computers store integers in binary, but output them in decimal. However, decimal is just one representation, we just happen to find it convenient. This challenge is to write some code to output ...
14
votes
15answers
2k views

Generate Ulam Numbers

Given an integer n (where n < 10001) as input, write a program that will output the first n Ulam numbers. An Ulam number is defined as follows: U1 = 1, U2 = 2. For n > 2, Un is the smallest ...
58
votes
13answers
5k views

Sort a list and write some English!

Your boss managed to read the secret hidden message. He didn't end up firing you, though, he just made you a secretary and forbade you from writing code. But you're a programmer. You need to write ...
-5
votes
3answers
158 views

Swap two numbers without using third variable [duplicate]

What are the tricks to swap two numbers without using a third variable. I am aware of the below. Let me know, what other ways we could swap two numbers? x=x+y; y=x-y; x=x-y;
0
votes
1answer
144 views

Write a “Look-and-Say Numbers” generator [duplicate]

There is a sequence of numbers called the "Look-and-Say Numbers". Here is an example of the first 5 terms of the sequence, starting at 1 (with spaces added between the digits): 1 1 1 2 ...
3
votes
1answer
163 views

Calculate the Riemann Zeta Function [closed]

Calculate the Riemann zeta function to the maximum primitive precision in your language (for C-family, that would be double or long double, var in JS, etc.) No need for BigDecimal or the like unless ...
10
votes
7answers
533 views

Molar masses of compounds

Task Write a program that takes in a compound made solely of elements with an atomic number less than or equal to 92 (Uranium), and outputs the molar mass of the compound in grams/mole. Rules and ...
0
votes
5answers
310 views

Implement atoi function [duplicate]

You already know that the atoi function of stdlib.h converts a string to an integer. atoi (copied from here) int atoi (const char * str); Convert string to integer Parses the C-string ...
12
votes
8answers
1k views

Spell out numbers in French

There was a challenge to convert a number to its numeral in English, but that was too straightforward. Given a number 0–100, your task is to output the corresponding numeral in French. The French ...
3
votes
4answers
414 views

Difference of expressions when evaluated in different orders

We all know the standard order of operations for math functions (PEMDAS), but what if we instead evaluated expressions left-to-right? The Challenge Given a string through standard input or through ...
2
votes
1answer
983 views

A Most Excellent Code Golf Adventure

You dudes, the Most Excellent Adventure is a home brew roleplaying game system based on the Bill & Ted Films, plays gnarly air guitar riff. In this game system, when you draw from your dice pool ...
10
votes
37answers
4k views

Return the flipped version of a number

Given a one digit number, return the number "flipped". Imagine it is a seven-segment display, so 2 would be: And when flipped horizontally it would make: Therefore when 2 is entered, the ...
56
votes
41answers
9k views

Largest number in ten bytes of code

Your goal is to print (to the standard output) the largest number possible, using just ten characters of code. You may use any features of your language, except built-in exponentiation functions. ...
2
votes
2answers
485 views

Saying a number in the shortest way

A string of digits (positive integer) can be converted to plain English in various ways. For instance, 115 can be read as "hundredfifteen", "oneonefive", "elevenfive", "twoonesfive". So question's ...
6
votes
23answers
1k views

Missing Odd Numbers

A set of whole numbers (0-) will be given separated by a space. Some numbers will be missing between certain numbers in the set. Your job is to find the missing odd numbers between them. Conditions ...
20
votes
12answers
3k views

Print the Golden Ratio

This was fun! However with only three digits, the fun was over way too soon. This challenge is similar, but we'll keep the fun going. The Challenge Print as many digits of the Golden Ratio φ as ...
4
votes
3answers
246 views

Pack sequences of non-negative integers

Let N be the set of nonnegative integers, i.e. {0, 1, 2, 3, ...}. Let c0(N) be the set of all infinite sequences in N that converge to 0, i.e. { (xn) ∈ NN | xn → 0 as n → ∞}. ...
7
votes
0answers
537 views

X greater than 3 with at least 2 difference between X and Y

I am trying to golf down some C++. Is it possible to make this condition shorter? X > 3 & X - Y > 1 (Apart from removing whitespace, of course.) So, X is at least 4 but X >= Y + 2. X ...
3
votes
3answers
310 views

Find the next subpermutation of base-64 digits

Permutations of a set have a natural order called lexicographic order in which two permutations are compared by comparing the first position at which they differ. For the purposes of this question ...
19
votes
6answers
2k views

Closest fraction

Task: Your program is given a proper, positive simple fraction in the format <numerator>/<denominator>. For this input, it must find two fractions. A fraction that is less than the ...
11
votes
5answers
562 views

Shortest representation of an Underload number

Flavour text The stack-based esolang Underload has some interesting ties to functional programming. One of them is its treatment of the numerical datatype—like the lambda calculus, you ...
5
votes
6answers
528 views

Generate random PESEL number

From Wikipedia: PESEL is the national identification number used in Poland since 1979. It always has 11 digits, identifies just one person and cannot be changed to another one. It has ...
16
votes
1answer
742 views

Android Lock Screen

Intro You are sitting in a board room at the end of a long table. You look around and see Tim Cook, the Apple Board of Directors, the ghost of Steve Jobs, and Jack Donaghy. Apple has called this ...
-3
votes
5answers
238 views

Unique number generator [closed]

CHALLENGE: Write a pattern formula that outputs a 8 digit number, unique to a given input number. For Example: 12982311 for 1 (this means that 12982311 is always returned for number 1) 23919076 ...
88
votes
108answers
19k views

4, 8, 15, 16, 23, 42

4, 8, 15, 16, 23, 42 Write a program that outputs this sequence of numbers infinitely. However, The Numbers must not appear in your source code anywhere. The following is not a valid Java program to ...
36
votes
14answers
9k views

Longest code to add two numbers [closed]

Task: I know we can all add two numbers the short way, using +. Your task is to create the longest code you can to add two input numbers. Rules: All of the code must be on topic (don't fill it ...
2
votes
15answers
546 views

Random number generation, without built-in random number generation libraries [duplicate]

Task: Make a random number generator. The catch is that you can't use any built-in randomness functions. Your random numbers must be anything between 0 and 100, though they do not have to be floating ...
11
votes
23answers
963 views

Calculate all the squares up to x using only addition and subtraction

The goal is to calculate all the squares up to x with addition and subtraction. Rules: The code must be a function which takes the total number of squares to generate, and returns an array ...
20
votes
31answers
3k views

Letters in phone numbers

Problem: You are making a new phone where people can type in specialized phone numbers, for example, 1-800-program, and they would be converted automatically to a usable phone number, like ...
7
votes
13answers
670 views

Convert from base 10 to base 2 without built-in base conversions

Background: You have been given an assignment to convert base 10 numbers to base 2 without using any premade base conversion functions. You can't use any imported libraries either. Problem: ...
-1
votes
9answers
618 views

Build a numerical library without using any primitive data type

The task is to build a numerical library for working with arbitrarily large integers that supports the following operations: addition subtraction multiplication division modulo operation However, ...
0
votes
7answers
213 views

Find all problems that equal an integer [duplicate]

In this challenge, your job is to write a program that allows a user to enter an integer. Then, the program must find all the possible ways of multiplying two numbers to get the user's integer. Rules: ...
6
votes
5answers
826 views

Convert radicals to mixed & entire radicals and to real numbers

Challenge The goal of this challenge is to take a radical and convert it to a reduced and entire radical, and a real number. You do not have to convert it to all 3, however, you will get bonus points ...
65
votes
61answers
13k views

Largest Number Printable

Before opening this I've done a little search and I've found there is a similar question, but it has been closed because it was ambiguous. I hope this won't. So, your goal is to write a program that ...
3
votes
3answers
474 views

Solve Any Motion Physics Problem (Equations Supplied)

Physics Challenge This program should be able to solve for ANY two of the following variables the user wants to solve. s (displacement) v (velocity) u (initial velocity) a (acceleration) t (time) ...
12
votes
5answers
278 views

Hardy–Ramanujan number generalization

1729, known as the Hardy–Ramanujan number, is the smallest positive integer that can be expressed as the sum of two cubes of positive integers in two ways (12^3+1^3=10^3+9^3=1729). Given an integer n ...
3
votes
2answers
121 views

Convert integer to balanced dozenal

Create a function which takes an integer and returns an array of integers representing the number in balanced base twelve. Specifically, the representation should follow these rules regarding 6 & ...