# Questions tagged [integer]

For challenges involving the manipulation of integers.

292 questions
Filter by
Sorted by
Tagged with
3k views

### Illustrate the Least Common Multiple

Given two positive integers, A and B, illustrate their least common multiple by outputting two lines of dashes (-) with length LCM(A, B) after replacing every Ath ...
2k views

### Dizzy integer enumeration

Your challenge today is to output a given term of a sequence enumerating all of the integers. The sequence is as follows: If we have a 0-indexed function generating the sequence ...
1k views

### Pandigital Doubling

Inspired by this CMC Given a positive integer greater than 0, perform the following operation on it: If all ten single digits (1234567890) are in the number at ...
3k views

### Sort the points by linear distance in a 3D space

Specs You have a cubic 3D space x,y,z of size S integer units, such as 0 <= x,y,z <= S...
1k views

### Sum the deltas of my matrix

Background The deltas of an array of integers is the array formed by getting the differences of consecutive elements. For example, [1, 2, 4, 7, 3, 9, 6] has the ...
2k views

### Find the sum of the divisors of N

Write a program that displays on the screen the sum of the divisors of a number (1 ≤ N ≤ 100) entered by the user in the range of 1 to N. This is OEIS A000203. Examples: Input: 7 ...
3k views

### Help! My calculator malfunctions!

Introduction My calculator is behaving weird. Sometimes when I type in an 8 it displays a 2. And sometimes when I type in a <...
692 views

### Sum the rows of the concatenated triangle

Consider the following triangle. 1 23 456 7891 01112 131415 1617181 92021222 324252627 2829303132 33343536373 839404142434 4454647484950 51525354555657 585960616263646 5666768697071727 ...
206 views

### Collatz's First Conjecture [duplicate]

Background The Collatz Conjecture is quite well-known. Take any natural number. Triple and increment if odd; cut in half if even. Repeat, and it will reach 1 eventually. This famous conjecture, ...
1k views

### The Binary Binary Expansion

Normally, we decompose a number into binary digits by assigning it with powers of 2, with a coefficient of 0 or 1 for each term: ...
535 views

### Count the Palindromes [duplicate]

Given a number n, calculate the amount of bases in the range of [2, n) in which b(n) is a ...
347 views

### Playing Darts: become an amateur with the most efficient prioritizing

Introduction: I think most people will know how darts work. But since some might not, here are the rules of playing Darts in a nutshell: Amount of players: 2 Starting points: 501 Goal: Get your ...
2k views

### Circularly moving sum

Inspired by a question at Stack Overflow. Given a non-empty array of integers x and a positive integer n, compute the sum of ...
2k views

### Skip like a frog!

Given an array of non-negative integers, your task is to only keep certain elements of it, as described below. Let's say the array is ...
1k views

### Keep/Drop/Increase Sequence

Here is the sequence I'm talking about: {1, 4, 5, 9, 10, 11, 16, 17, 18, 19, 25, 26, 27...} Starting from 1, keep 1, drop the next 2, keep the next 2, drop 3, ...
70 views

### Turn an integer n into an N-DIMENSIONAL list [duplicate]

Inspired by this question. Given an integer n, create an n-dimensional list of "length" n in every dimension, where every element is n. Rules: If your language has a built-in that does this, you ...
6k views

### Turn an integer n into a list containing it n times

Given an integer n as input, return a list containing n, repeated n times. For example, the ...
2k views

### Undo a Range of Numbers

It is fairly simple to, given a number n, create a range from 0 to n-1. In fact, many ...
2k views

### It's a Bit of a Stretch․․․

Input: We take two inputs: An input b with two distinct values: Left and Right.† And a ...
246 views

### Syllables in a Number [closed]

Make a program/function which takes in an integer from 0 to 999999999999 (inclusive) as input and returns how many syllables it has when spoken in English. Make your code short. Specification A ...
3k views

### Fold the integer to save space!

The crazy mathematician owns a wide collection of numbers, and therefore the space he has left is quite limited. To save some, he must fold his integers, but unfortunately he is really lazy. Your task,...
4k views

### Make a Spiky Box

Given two positive integers, W and H, output an ASCII-art box whose border is made of slashes (/ and \) with W "spikes" on the ...
751 views

### prepend,append-Sequence

Task The prepend,append-Sequence is defined recursively, like this a(1) = 1 a(n) = a(n-1).n , if n is even a(n) = n.a(n-1) , if n is odd where the . represents an integer concatenation. So the ...
1k views

### Products that equal a sum and vice versa

A fun pair of equivalences is 1 + 5 = 2 · 3 and 1 · 5 = 2 + 3. There are many like these, another one is 1 + 1 + 8 = 1 · 2 · 5 and 1 · 1 · 8 = 1 + 2 + 5. In ...
2k views

### Float 754 to Hamming

You will be given as input an integer k in the range from -4503599627370496 (−252) to ...
1k views

### Collapse consecutive integers

Related: Tell me how many math problems I have to do! Challenge Given a strictly positive strictly ascending integer list L and an integer 3 ≤ N ≤ length of L, replace the middle integers of L's ...
537 views

### The bouncing sequence

Let us define a sequence. We will say that $a(n)$ is the smallest number, $x$, that has the following properties: $x$ and $n$ are co-prime (they share no factor) $x$ does not appear ...
899 views

### Complex Dice Rolling Expressions

Background I play D&D on a regular basis with some friends. While talking about the complexity of some systems/versions when it comes to rolling dice and applying bonuses and penalties, we ...
1k views

### Find the Serialized Integer

Task Write a program that will take (as input) a positive integer. It will then count up from 0, appending each integer to a ...
2k views

### Find the nearest biquadratic number

A biquadratic number is a number that is the fourth power of another integer, for example: 3^4 = 3*3*3*3 = 81 Given an integer as input, output the closest ...
352 views

### Find the coefficients of a rational generating function

If we write a sequence of numbers as the coefficients of a power series, then that power series is called the (ordinary) generating function (or G.f.) of that sequence. That is, if for some function <...
2k views

### Pascal's Rhombus

Pascal's Rhombus (which is actually a triangle) is obtained by adding in the pattern: * *** x instead of * * x This ...
2k views

### Fewest operations to 100

Overview Given a list of digits, find the fewest operations to make 100 Input A string of digits, which may or may not be in numerical order. The order of the digits cannot be changed, however plus ...
1k views

### The Lehmer-Comtet sequence

The Lehmer-Comtet sequence is a sequence such that a(n) is the nth derivative of f(x) = xx with respect to x as evaluated at x = 1. Task Take a non-negative integer as input and output the nth term ...
3k views

### Triangular Dependencies

A triangular number is a number that is the sum of n natural numbers from 1 to n. For example ...
5k views

### Find the highest unique digit

Surprisingly we haven't had a simple "find the highest digit" challenge yet, but I think that's a little too trivial. Given input of a non-negative integer, return the highest unique (ie not repeated)...
2k views

### N-dimensional identity “matrix”

Given a positive integer n, output the N-dimensional identity "matrix", which is the N^N ...
1k views

### Spin the Calculator

Introduction: Let's take a look at a standard Calculator in Windows: For this challenge, we'll only look at the following buttons, and ignore everything else: ...
6k views

### Count like Chuck Norris

As is well known, Chuck Norris counted to infinity. Twice Besides, Chuck Norris can count to infinity backwards. Also, although perhaps less known, Chuck Norris can speak a little Spanish in ...
922 views

### Emoticon numbers!

(related) Your challenge is to output the highest number you can. You can output as a number or as a string. You must output something that matches the regex ^\d+\$,...
788 views

### Counting N-bit integer multiplication overflows

Given a positive integer N, output the number of pairs of integers 0 <= a <= b < 2**N such that ...
4k views

### CSI: Minecraft Items

Minecraft 1.12 will be released tomorrow, so let's celebrate! Write code that takes in a non-negative integer N which represents the number of items of something in Minecraft. Output it in a way more ...
683 views

### Do two numbers contain unique factorials?

Break two numbers up into their factorials; if they share any, return a falsey value. Otherwise, return a truthy value. (inspired by this recent question) In other words, write each input number as ...
2k views

### Do two numbers contain unique powers of 2

Break two numbers up into their powers of 2, if they share any, return a falsey value. Otherwise, return a truthy value. If one input is 0, the answer will always ...
679 views

### Miller-Rabin Strong Pseudoprimes

Given a non-negative integer N, output the smallest odd positive integer that is a strong pseudoprime to all of the first N ...
3k views

### Interleave numbers from 1 to n, with the same numbers reversed

A simple one: Take a positive integer n less than 1000, and output the integers from 1 to n interleaved with the integers from n to 1. You must concatenate the numbers so that they appear without any ...
361 views

### Find all Number Relations

Inspired by: Find an Unrelated Number Challenge Given two positive integers as input, output the mathematical operations that can be used on those inputs to generate every number from ...
2k views

### Find an Unrelated Number

Given 2 non-negative integers as input, output a non-negative integer that cannot be created through any mathematical operators on the 2 inputs. For example, given inputs ...