# Questions tagged [integer]

For challenges involving the manipulation of integers.

291 questions
Filter by
Sorted by
Tagged with
2k views

### Digital Sumorial

Given an input n, write a program or function that outputs/returns the sum of the digital sums of n for all the bases 1 to ...
1k views

### Prime containment numbers (speed edition)

This is sequence A054261 The $n$th prime containment number is the lowest number which contains the first $n$ prime numbers as substrings. For example, the number $235$ is the lowest number ...
2k views

### Prime containment numbers (golf edition)

This is sequence A054261. The $n$th prime containment number is the lowest number which contains the first $n$ prime numbers as substrings. For example, the number $235$ is the lowest number ...
2k views

### Sort by Largest Digit(s)

Challenge: Given a list of integer, sort descending by their single largest digit(s). The order for numbers with the same largest digit are then sorted by second largest digit, etc. We ignore ...
2k views

### Reciprocal copycats

Let $A$ be a positive integer consisting of $n$ decimal digits $d_1,d_2,...,d_n$. Let $B$ be another positive integer. For the purpose of this challenge, we call $A$ a copycat of $B$ if ...
2k views

### All the single eights

Given a non-empty rectangular array of integers from 0 to 9, output the amount of cells that are ...
1k views

### Through Space and Time

Introduction: In general we usually speak of four dimensions: three space dimensions for x, y, and ...
2k views

### Print the Lost numbers

As a big fan of the Lost TV series, I always got intrigued by the sequence of numbers that repetitively appears on the episodes. These numbers are: $4, 8, 15, 16, 23, 42$ (A104101) Using any ...
2k views

### The inverse Collatz Conjecture

I think the Collatz Conjecture is already well-known. But what if we invert the rules? Start with an integer n >= 1. Repeat the following steps: If n is even, multiply it by 3 and add 1. If n is ...
1k views

### New Neighbour Sequence

The non-negative integers are bored of always having the same two* neighbours, so they decide to mix things up a little. However, they are also lazy and want to stay as close as possible to their ...
2k views

### The Written Digits Sequence

Here's a reasonably trivial sequence which is not in the Online Encyclopedia of Integer Sequences. Start with an empty sequence then define each term as the number of characters required to write out,...
957 views

### Multiplicative undelta

Let us define the "multiplicative deltas" of values $[\; a_0, \cdots a_N, \;]$ as: $$[\; a_1 / a_0, \cdots, a_{i+1} / a_i, \cdots, a_N / a_{N-1} \;]$$ The reverse operation - namely "...
937 views

### Length of a UTF-8 byte sequence

Determine the length of a UTF-8 byte sequence given its first byte. The following table shows which ranges map to each possible length: ...
622 views

134 views

### Every positive integer can be written as the sum of 3 palindrome integers. Wha'ts the largest possible palindrome integer for each integer n? [duplicate]

Let n be a positive integer then n = a + b + c for some a, b, and c that are palindrome integers. What is the largest possible integer ...
4k views

### Longest Repeating Subsequence of a Single Digit

Challenge: Given a positive integer, output the longest single-digit subsequence that occurs at least twice, AND has boundaries of another digit (or the start/end of the integer). An example: Input:...
656 views

### Whose neighbours are hostile?

Introduction For the purposes of this challenge, we will define the neighbours of an element $E$ in a square matrix $A$ (such that $E=A_{i,j}$) as all the entries of $A$ that are immediately ...
5k views

2k views

### Replace me by the sum of my cyclic successors!

I have a simple challenge for you this time. Given an array of positive integers A (or the equivalent in your language), replace each entry Ai with the sum of the next Ai elements of A, cycling back ...
670 views

### Classify a region by its slope

Definitions The kth ring of a square matrix of size N, where 1 ≤ k ≤ ceiling(N/2) is the list formed by the elements of the kth and (N-k+1)th rows and columns, but without the first and last k-1 ...
3k views

### X Steps Forward, 1 Step Back

Here the first 100 numbers of an easy sequence: ...
3k views

### Up and down, up and down

Challenge: Given a positive integer input n, create a vector that follows this pattern: 0 1 0 -1 -2 -1 0 1 2 3 2 1 0 -1 -2 -3 -4 -3 -2 -1 ... ±(n-1) ±n ...
164 views

### Make Three from One [duplicate]

Given a single digit integer and a three digit integer, output a mathematical formula that uses only the single digit and a given list of operators to equal the three digit integer. Input: A one ...
2k views

This challenge is related to some of the MATL language's features, as part of the May 2018 Language of the Month event. Introduction In MATL, many two-input functions work element-wise with ...
2k views

### Knight Distance

In Chess, a Knight on grid (x, y) may move to (x-2, y-1), (x-2, y+1), (x-1, y-2), (x-1, y+2), (x+1, y-2), (x+1, y+2), (x+2, y-1), (x+2, y+1) in one step. Imagine an infinite chessboard with only a ...
73 views

### Generate lowest degree polynomial from sequence [duplicate]

Introduction A sequence of numbers is passed in as the input. The program has to generate the lowest degree polynomial possible. This was my first programming project in college and it would be ...
1k views

### Arithmetic Cycle

Input: Integer n which is >=0 or >=1 (f(0) is ...
774 views

### Digit Occurrences

Input: A list of integers (which will never contain a zero) Output: A list of the same size with counts based on the following: If the current item is negative: Look at all items before this item, ...
1k views

### Interval Notations

Challenge: Input: Two integer parameters a and b (where a<b and the difference is at ...
2k views

### Not Quite Roman Ternary

Given an integer n ≥ 0 , output it in a non-positional base-3 notation, using digits 139ABCDE… and a 1-character separator. Every digit is a consecutive power of 3 ...
2k views

### Digits in their lanes

Input: A list of integers Output: Put each digit (and the minus sign) in its own lane, in the order -0123456789, ignoring any duplicated digits. Example: Input:...
4k views

### Which Card is it?

Introduction Long ago, when I used to code card games with usual playing cards, I used to specify a number for each card and call a function with some number to get a card. This somewhat inspired me ...
1k views

### Is this a truncated triangular number?

Related OEIS sequence: A008867 Truncated triangular number A common property of triangular numbers is that they can be arranged in a triangle. For instance, take 21 and arrange into a triangle of <...