# Questions tagged [integer]

For challenges involving the manipulation of integers.

442 questions
Filter by
Sorted by
Tagged with
723 views

### Construct a uInt from an array of bits

Task is simple! Take an array of binary values (can be boolean, 0/1, etc.) and use those bits to construct an n-th bit long unsigned integer (return type does not need to be an unsigned integer, just ...
5k views

### FizzFizzFizzBuzz!

Given a positive integer n, output the "FizzFizzFizzBuzz" sequence for that number: print the decimal representations of the numbers 1 through ...
1k views

### Emulate Jelly's tie-scan

The golfing language Jelly has a built-in ƭ called "tie", that cycles through a list of functions every time it's called. For example, ...
• 38.4k
2k views

### Break an integer into even- and odd-indexed bits

Objective Given an integer $n$ interpreted as two's complement binary, output two integers, namely the integer consisting of $n$'s bits at places of $2^0, 2^2, 2^4, \cdots$, and the integer ...
• 5,951
192 views

### Rank poker High Card hands [closed]

In the poker game there are 1277 unique 'High Card' ranks. It's 1287 (13 over 5) if we include all straights. The challenge is to write a function which returns an integer value corresponding to the ...
• 123
2k views

### How quickly can you type this unary string?

If I want to type the string aaa, the least keystrokes I can type it in is 3: a a a. But if I want to type the string ...
• 38.4k
953 views

### Manipulate integers to zero

Objective Given a nonempty unordered list of positive integers, decide whether they can be added, negated, or multiplied to yield a single zero. Each given number must be used exactly once. There is a ...
• 5,951
2k views

### Is it a tetrate of two?

The tetration operation consists of repeated exponentiation, and it is written ↑↑. For instance, 3↑↑3 =3 ^(3^3) = 3^27 = 7,625,597,484,987 A tetrate of two is an ...
• 42k
2k views

### Divmod continuously until the remainder is 1 or 0, then get the remainder

The task is simple, divide, get the quotient and the remainder, and if the remainder isn't 1 or 0, do the same thing (quotient divmod remainder) until the remainder is 1 or 0, then get the remainder. ...
• 3,847
1k views

### Counting Collinear Points

Given two points $(x_1, y_1)$ and $(x_2, y_2)$ with integer coordinates, calculate the number of integer points (excluding the given points) that lie on the straight line segment joining these two ...
• 2,163
593 views

### Which line is best?

Consider an $n \times n$ grid of integers. The task is to draw a straight line across the grid so that the part that includes the top left corner sums to the largest number possible. Here is a ...
• 2,926
2k views

### Rudin-Shapiro sequence

The Rudin-Shapiro sequence is a sequence of $1$s and $-1$s defined as follows: $r_n = (-1)^{u_n}$, where $u_n$ is the number of occurrences of (possibly overlapping) $11$ in the binary ...
• 48.2k
2k views

### Monotone sequence beatitude

Provided that the input is a monotone sequence of three or more integers: Output -2 if the sequence strictly decreases. Example: [7,4,3,2] Output -1 if the ...
• 5,951
2k views

Given two natural numbers (less than 100) as input print the sequence of intermediate results obtained when computing the sum of the two numbers using only the following operations1: ...
• 6,015
2k views

• 34.9k
597 views

### RADD decomposition of an integer

Introduction The $RADD(n)$ operation is defined as the sum of $n + [$ the number whose decimal representation are the decimal digits of $n$ in reverse order $]$, see A004086. After reversal, ...
507 views

### Find a matrix whose sliding sum is the input

Given a matrix like this: 1 1 3 -2 3 -4 1 -1 1 1 1 0 0 -1 0 0 By taking a 2×2 "sliding sum", where the sum of every 2×2 region of the matrix is ...
• 18.7k
1k views

### Carryless factors

Carryless multiplication is an operation similar to binary long multiplication, but with XOR instead of addition: ...
• 18.7k
2k views

### Carry-less sum given a base b

Given a list of positive integers $\mathcal I=I_1,I_2,I_3,...,I_n$ and a base $b>1$ return their "carry-less sum", i.e. represent $\mathcal I$ in base $b$ and sum digit-by-digit ...
• 16.7k
1 vote
212 views

### Find number components with lowest distribution

Let us assume that we have number X. Let us assume that we have positive integer "components" (C) of this ...
• 143
1k views

### Cryptic Multiplications

Given two non-negative integers e.g. 27, 96 their multiplication expression would be 27 x 96 = 2592. If now each digits is ...
• 2,273
2k views

### Shifted auto-sum

Let’s take a positive integer such as 123. We define the shifted auto-sum of this integer as follows: 123 has 3 digits. We thus consider 3 copies of 123. We stack ...
• 38.7k
996 views

### Exponential transform of an integer sequence

The exponential generating function (e.g.f.) of a sequence $a_n$ is defined as the formal power series $f(x) = \sum_{n=0}^{\infty} \frac{a_n}{n!} x^n$. When $a_0 = 0$, we can apply the ...
• 48.2k
3k views

### How far from binary?

Given a decimal integer n as input, output the smallest (in terms of absolute value) decimal integer m such that the absolute ...
• 38.7k
2k views

### Find the nth Fibonacci number, where n is the mth Fibonacci number

Introduction If $\newcommand{\fib}{\operatorname{fib}}\fib(x)$ calculates the $x$th Fibonacci number, write a program that calculates $\fib(\fib(m))$ for any integer value of $m \ge 0$. (Of ...
• 1,580
914 views

### Spell out an integer... in NDos' way

Objective Given a positive integer, spell it out in the conlang I made. Specification Let $n$ be the inputted integer. $n$ shall be spelled out in the following specification. The entire spelling ...
• 5,951
2k views

### Is it 1089-able?

$1089$ is a very special number. To prove why, select any 3-digit number whose first and last digits differ by at least 2. Then, reverse the digits, and take the difference of these two numbers. ...
• 22.7k
1k views

...
• 10.8k
1k views

### The interstice of two binary numbers

Given two integers, compute the two numbers that come from the blending the bits of the binary numbers of equal length(same number of digits, a number with less digits has zeros added), one after the ...
• 420
2k views

### Randomly Rounding

Input a decimal number and round it to an integer, randomly rounding up or down with a probability based on its fractional part, so the expected value of the output equals to the input value. If ...
• 34.9k
573 views

### Double bit rotation to the right [closed]

Given a positive integer as input, output that integer, but with its bits rotated two times to the right. Also, think of the number as a donut of bits, eg. ...
• 1,123
296 views

### Line Islands in a Word Search

My third word search related challenge in a row. :) Challenge: Brief explanation of what a word search is: In a word search you'll be given a grid of letters and a list of words. The idea is to cross ...
• 127k