Skip to main content

Questions tagged [integer]

For challenges involving the manipulation of integers.

37 votes
50 answers
4k views

The least common multiple of a set of positive integers A is the smallest postive integer B such that, for each ...
user avatar
90 votes
201 answers
12k views

Given a number N, output the sign of N: If N is positive, output 1 If N is negative, output -1 If N is 0, output 0 N will be an integer within the representable range of integers in your chosen ...
user avatar
72 votes
177 answers
13k views

Write a program or function which will provably print all integers exactly once given infinite time and memory. Possible outputs could be: ...
Fatalize's user avatar
  • 39.6k
71 votes
66 answers
7k views

In: Enough memory and a positive integer N Out: N-dimensional N^N array filled with N, where N^N means N terms of N-by-N-by-N-by... Examples: 1: [1] ...
Adám's user avatar
  • 31.9k
33 votes
60 answers
8k views

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. ...
Michelfrancis Bustillos's user avatar
17 votes
105 answers
9k views

Given an integer n as input, return a list containing n, repeated n times. For example, the ...
Bruno E's user avatar
  • 433
25 votes
25 answers
2k views

Mountain range number A number is a mountain range number if the inequalities satisfied by their consecutive digits alternate. In a way, looking at the number's digits should exhibit a ...
RGS's user avatar
  • 14.2k
34 votes
56 answers
4k views

Introduction: Although we have a lot of challenges where swapping two items in a list is a subtask, like Single swaps of an array; Swap to Sort an Array; \$n\$ swaps into a nop; etc., we don't have ...
Kevin Cruijssen's user avatar
24 votes
9 answers
1k views

If we take the natural numbers and roll them up counter clock-wise into a spiral we end up with the following infinite spiral: ...
ბიმო's user avatar
53 votes
43 answers
4k views

Given two positive integers, \$A\$ and \$B\$, illustrate their least common multiple by outputting two lines of dashes (-) with length \$\text{lcm}\$\$(A, B)\$ ...
Calvin's Hobbies's user avatar
45 votes
48 answers
5k views

Alternating Arrays An alternating array is a list of any length in which two (not necessarily different) values are alternating. That is to say, all even-indexed items are equal, and all odd-indexed ...
FlipTack's user avatar
  • 14.8k
43 votes
56 answers
10k views

Task Write a function/program that, given three positive integers a, b and c, prints a ...
RGS's user avatar
  • 14.2k
40 votes
75 answers
7k views

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 ...
Mayube's user avatar
  • 11.8k
38 votes
53 answers
4k views

A binary multiple of a positive integer k is a positive integer n such that n is written ...
RGS's user avatar
  • 14.2k
37 votes
41 answers
5k views

A number is a Mersenne Prime if it is both prime and can be written in the form 2n-1, where n is a positive integer. Your task is to, given any positive integer, determine whether or not it is a ...
FlipTack's user avatar
  • 14.8k

15 30 50 per page
1
2 3 4 5
10