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

learn more… | top users | synonyms

-5
votes
3answers
117 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
133 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
153 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
510 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
289 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
930 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
400 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
949 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 ...
11
votes
35answers
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 ...
55
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
469 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
21answers
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
232 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 → ∞}. ...
3
votes
3answers
305 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 ...
14
votes
5answers
1k 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
508 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
425 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 ...
15
votes
1answer
707 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
229 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 ...
85
votes
107answers
18k 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
515 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
949 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
652 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
614 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
205 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
288 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 ...
64
votes
61answers
12k 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
414 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
256 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
116 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 & ...
5
votes
4answers
404 views

Cardinal Numbers in Standard American English

Let n be any integer between 1 and 999,999 inclusive. Your challenge is to write a complete program which using stdin or command-line arguments takes in n and outputs the number of times the letter ...
-1
votes
9answers
256 views

Check whether there are more even than odd numbers on any given nested list [closed]

Take any type of nested list(s) containing numbers. Check for how many even/odd numbers are within and output even, same or odd (-1, 0, 1) in some way. Example: [[1,2,3],4,[5,6],[[7,8], 9]] => 5 ...
14
votes
28answers
1k 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 ...
4
votes
6answers
376 views

Test if given number is a Reverse Keith?

Slighty inspired by my previous challenge regarding Keith Numbers I want to propose a challenge to create a function that takes an integer and gives back a true or false depending on the number is a ...
7
votes
7answers
716 views

Enumerate all number that are palindromic in at least two of base 2, 8, 10, 16 or 64

Multi palindromic numbers Finding all number for which at least two** representation are palindromic, with more than one** characters, if in decimal, octal, hexadecimal, binary or in base64. ** have ...
4
votes
4answers
831 views

Make a 24 Game Solver

The 24 Game is a card game. On each cards are four interger numbers. For a player, the goal is to use Addition, Subtraction, Multiplication and Division to end up with 24. The goal of this code ...
8
votes
14answers
723 views

Generate a grid of sums

Challenge Generate a 7 by 7 grid, filled with random numbers. However, every other row and column, you must use the sum of the surrounding cells. Here's a small example with a 3 by 3 grid: 2 2 2 2 ...
0
votes
5answers
270 views

highest common factor-fewest iterations

Find the highest common factor of two(positive integer) input numbers (not greater than 5000) in the minimum number of iterations. If you use a loop, it should increment a counter, starting at 0 for ...
3
votes
5answers
301 views

Generate cyclic numbers in decimal

The formula on the wiki article for cyclic numbers can be used to generate cyclic numbers in any base. Using this formula, or any other appropriate formula, compute the first ten cyclic numbers in ...
19
votes
10answers
2k views

Flipping pancakes

In pancake sorting the only allowed operation is to reverse the elements of some prefix of the sequence. Or, think of a stack of pancakes: We insert a spatula somewhere in the stack and flip all the ...
25
votes
29answers
3k views

Define a function f such that f(f(n)) = -n for all non-zero integers n

This challenge was inspired by a programming blog I frequent. Please see the original post here: A Programming Puzzle Challenge Define a function f:Q->Q such that f(f(n)) = -n for all ...
8
votes
14answers
930 views

FIBonacci sequence

For this code golf, you will receive an input of a fibonacci sequence, that is, a normal Fibonacci sequence but with one number incorrect. See, the sequence is fibbing! Get it? :D Your job is to find ...
16
votes
8answers
811 views

Save money with price rounding

In Canada, the penny is no longer circulated. Cash payments are rounded to the nearest 5 cents. Money can be saved by splitting purchases. For example, two $1.02 items cost $2.04 which rounds up to ...
15
votes
11answers
2k views

Convert to and from the factorial number system

The Factorial Number System, also called factoradic, is a mixed radix numeral system. The factorials determine the place value of a number. In this system, the right most digit can be either 0 or 1, ...
2
votes
8answers
893 views

Compute the number of ways how you can express a number as a sum

For a given natural number n, compute the number of ways how one can express n as a sum of positive natural numbers. For example, for n = 1 there is just one way. For n = 4 we have 5 possible ways: 1 ...
19
votes
29answers
2k views

Print an arch of ascending / descending numbers

I figured an "arch" was the best way to describe this pattern of numbers: 1234567887654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 ...
-4
votes
6answers
300 views

Return the number of digits in any given number [closed]

Objective Given any terminating, rational number, return the number of digits the number contains. Do not count zeros if they're the last digits. Examples 0 returns 1 -1 returns 1 6.23 returns 3 ...