Questions tagged [integer]
For challenges involving the manipulation of integers.
461 questions
18 votes
8 answers
1k views
English to Dutch number order conversion
Introduction: When saying numbers out loud, the order is slightly different in Dutch than in English. For a number like \$1234\$: in English you'd say: one thousand, two hundred and thirty-four in ...
20 votes
31 answers
2k views
Numbers Interpreted in Smallest Valid Base
Let us define the operation of rebasing a number as writing out its digits in decimal form, then interpreting them in the smallest base N possible (...
10 votes
2 answers
369 views
Check if a number is a power with its program value being a power
Task: Your task is make a program to check if there exists integers \$a \ge 2, b \ge 2\$ such that \$a^b=i\$ where \$i\$ is the input integer at least 2. The catch is that your program must return a ...
18 votes
30 answers
2k views
Add Y to X to get a palindrome
Given X>0, return the smallest Y>=0 such that X+Y is a palindrome. Code golf. Tests: 5 => 0 14 => 8 200 => 2 819 => 9 1100 => 11 1122 => 99
2 votes
13 answers
678 views
List of prime distances
Task: Write a code golf program that, given two positive integers n and m, returns a list of the distances between consecutive prime numbers in the range [n, m] ...
3 votes
1 answer
299 views
Long running section 11.4 Minsky machine
Challenge We define a Minsky machine as a program made of the following two instructions: +X which increments the register X and continues to the next instruction -Xn which simply continues if X is ...
-5 votes
4 answers
205 views
Determine if a rational number is an integer, without division [closed]
Determine if a rational number is also an integer, without any form of dividing. The input should be any pair of numerator and denominator. Don't forget to consider negative numbers, and division by ...
16 votes
21 answers
2k views
ZigZag encoding and decoding
ZigZag encoding is a method of encoding signed integers to unsigned integers. Non-negative integers are multiplied by two. Negative integers are equal to their absolute values multiplied by two, minus ...