# Questions tagged [integer]

For challenges involving the manipulation of integers.

292 questions
Filter by
Sorted by
Tagged with
1k views

### Inverse Deltas of an Array

Inverse Deltas of an Array Your task is to, given an array of signed 32 bit integers, recompile it with its inverse deltas. For example, the list 1 3 4 2 8 ...
3k views

### Let's decrease the monotony

...but hey, no need to be strict. Given a non-empty array of strictly positive integers, determine if it is: Monotone strictly decreasing. This means that each entry is strictly less than the ...
1k views

### Find the Emirps!

An emirp is a non-palindromic prime which, when reversed, is also prime. The list of base 10 emirps can be found on OEIS. The first six are: ...
766 views

### Binary Convolution

A binary convolution is described by a number M, and is applied to a number N. For each bit in the binary representation of <...
2k views

### Binary Countdown Length

inspired by Count down from infinity Given a non-negative integer N, output the number of repetitions of the following steps it takes to reach 0: Convert ...
2k views

### Produce Dürer's magic square

The challenge Output an array or string representation of Dürer's famous magic square: that is, 16 3 2 13 5 10 11 8 9 6 7 12 4 15 14 1 Some properties ...
3k views

### Draw an ASCII-O'-Lantern for Halloween

Halloween is almost here, the holiday after which most people need to wean themselves off a hollow diet of sugar. Write a program that takes in a positive integer. If the integer is less than 31 (1 ...
3k views

### Least Common Multiple

The least common multiple of a set of positive integers A is the smallest postive integer B such that, for each ...
8k views

### Print all integers

Write a program or function which will provably print all integers exactly once given infinite time and memory. Possible outputs could be: ...
4k views

### Greater than less than greater than something fishy

Given a length N string of less-than and greater-than signs (<, >), insert the integers 0 through N at the start and end ...
4k views

### As Easy as One-Two-Three

Write a program or function that takes in a positive integer. You can assume the input is valid and may take it as a string. If the number is any of ...
2k views

### Write a program that outputs the number of times it has been run [duplicate]

In a programming language of your choice, write a full program that, when run, prints a positive integer N and then modifies its own source file such that the next time it is run it will print N+1. ...
2k views

### Where are Champernowne's zeroes?

Consider the infinite string of all nonnegative decimal integers concatenated together in order (akin to Champernowne's constant): ...
4k views

### Smallest palindrome divisible by the input

Given a positive integer N, output the smallest positive integer such that this number is a palindrome (i.e. is its own reverse) and is divisible by ...
2k views

### Smallest positive number whose y-th power is divisible by x

Task Given integers x and y which are both at least 2, find the smallest positive number ...
530 views

### Smallest positive integer not yet appeared so that the sum of the first n elements is divisible by n

Task Given positive integer n, output a(n) where a is the sequence defined below: ...
615 views

### A047841: Autobiographical numbers

Definition Here is the process to describe a number: For each number from 0 to 9 that is present in the number: Write down the ...
2k views

### Integer goes back and forth through time

Input: An integer. Output: First convert the integer to it's equivalent Roman Numeral. Then convert each capital letter of that Roman Numeral to their ASCII/UNICODE decimal value. And output the ...
236 views

### “Break” a number [closed]

Origins tl;dw (too lazy, didn't write): thought of it right before I fell asleep Challenge Breaking a number is defined as the following steps: Take a number or a parseable data type as input in ...
4k views

### The fastest square root calculator

Write a program which outputs the square root of a given number in the shortest time possible. Rules It may not use any builtins or powering with non-integers. Input format as a function argument ...
2k views

### Calculate the sum of ILD

Input: An integer Output: Sum of the input itself + the length of the input + each individual digit of the input. nr + nr-length + {sum of digits} = output ...
565 views

### Excludivisible numbers

Given an integer N, output the Nth positive number K with the following property in decimal ...
4k views

### The happy Ender problem

The happy ending problem (actually a theorem) states that Any set of five points in the plane in general position has a subset of four points that form the vertices of a convex quadrilateral. The ...
2k views

### Separate alphabets and numbers

A paragraph of text has numbers and alphabetic letters mixed. Your task is to separate the numbers to the left side and the alphabetic letters to the right side in the same order of each line. Rules:...
3k views

### The Nine Pattern

Introduction I stumbled across this (useless) pattern the other day while I was watching TV. I named it "the 9 pattern" because the first number to use it was 9. The gist of it is, you enter a number ...
1k views

### Divisor reduction

A divisor of a number n is any number that evenly divides n, including 1 and n itself. The number of divisors d(n) is how many divisors a number has. Here's d(n) for the first couple n: ...
2k views

### Briefest code to find vowels and print consonants

Challenge: Read a string from user, print number of each vowel, then place all remaining chars in a line. Shortest answer wins! Output must look like this: Enter String: Input Vowel Count: a: ...
166 views

### Bijective mapping from integers to a variable number of trits

This challenge is a harder version of this one. A variable number of trits is an array of 0 or more trits (a trit is a ternary digit). So [0, 2, 2, 1] is a ...
2k views

### Polynomialception

Given two polynomials f,g of arbitrary degree over the integers, your program/function should evaluate the first polynomial in the second polynomial. ...
4k views

### Sort an Integer List

The Challenge It's quite simple really, sort a list of numbers. Details You must sort a list of numbers in ascending order, without using any built-in sorting functions/libraries/etc (i.e. ...
1k views

### Sorting rectangular matrices

Given a matrix A, we can say that it is "sorted" if each row and column of A is sorted (ascending left-to-right for rows and top-...
6k views

### Never tell me the odds

Input A integer n ( ≥ 1) and a digit d (an integer such that 0 ≤ d ≤ 9). In either order; from stdin or parameters or whatever; to a program or function; etc. ...
523 views

### Bijective mapping from integers to a variable number of bits

A variable number of bits is an array of 0 or more bits. So [0, 1] is a variable number of bits, but so is []. Write a function ...
3k views

### Big big numbers

Whilst trying to golf several of my answers, I've needed to write large integers in as few characters as possible. Now I know the best way to do that: I'll be getting you to be writing this program. ...
919 views

### Summation under Zeckendorf Representation

Zeckendorf's theorem shows that every positive integer can be uniquely represented as a sum of non-adjacent Fibonacci numbers. In this challenge, you have to compute the sum of two numbers in ...
820 views

### Integral triangles and integral medians

Consider a triangle ABC where each side has integer length (an integral triangle). Define a median of ABC to be a line segment from a vertex to the midpoint of the opposing side. In the figure below, ...
2k views

### Stacking Pythagorean Triangles

Background A Pythagorean triangle is a right triangle where each side length is an integer (that is, the side lengths form a Pythagorean triple): Using the sides of this triangle, we can attach two ...
862 views

### Help me procrastinate on my computer repairs!

This challenge is brought to you by real (and tragic) inspiration. Recently, the number row on my keyboard has been a bit sporadic. The keys 1-9 work sometimes--but ...
4k views

### Find the closest palindromic number

Given a number N, output/return X so that N+X is a palindrome, where |X| has to be as small as possible. Palindrome: A number is a palindrome, if its sequence of digits is the same when reading them ...
8k views

### Check whether an integer is a power of 2 without using +,- operations [closed]

Write a program that checks if the integer is a power of 2. Sample input: 8 Sample output: Yes Sample input: ...