Questions tagged [factoring]

This tag describes challenges related to factoring numbers and polynomials. Not related to the Factor programming language.

Filter by
Sorted by
Tagged with
9 votes
5 answers
1k views

Random factorized numbers

Input The code should take an integer \$n\$ between 1 and 1000. Output The code should output positive integers with \$n\$ bits. Accompanying each integer should be its full factorization. Each ...
Simd's user avatar
  • 2,024
13 votes
25 answers
994 views

Find the Prime Signature

The Prime Signature of a number is the list of the exponents of the prime factors of a number, sorted in descending order (exponents of 0 are ignored). Inspired by ...
Samathingamajig's user avatar
16 votes
11 answers
1k views

Carryless factors

Carryless multiplication is an operation similar to binary long multiplication, but with XOR instead of addition: ...
Rydwolf Programs's user avatar
12 votes
7 answers
814 views

Prime Factorization - but on the exponents too

Though there is a prime factorization challenge and it's here, this, I feel, will be a bit more interesting than that one. To understand this, let's have an example; I will use 5,184 for this. \$5184 =...
SegFaultPlus4's user avatar
0 votes
4 answers
196 views

Prime Factorization [duplicate]

Although there was a prime factors challenge posted ten years ago, it has tedious I/O and restricted time. In this challenge, your task is to write a program or function which takes an integer \$n \ge ...
Rydwolf Programs's user avatar
9 votes
8 answers
327 views

Squarefree Palindromes [closed]

Create the shortest function, program, or expression that calculates a sequence of squarefree palindromic numbers. A squarefree number is one which is not evenly divisible by a square number (i.e. ...
Neel Shukla's user avatar
23 votes
28 answers
3k views

"Factorise" a quadratic [duplicate]

When learning to factorise quadratics in the form \$x^2 + ax + b\$, a common technique is to find two numbers, \$p, q\$ such that $$pq = b \\ p + q = a$$ as, for such numbers, \$x^2 + ax + b = (x + p)(...
caird coinheringaahin g's user avatar
32 votes
20 answers
3k views

Looks prime to me!

Figuring out whether a given number is prime, while not very complicated, is kind of hard. But making a guess doesn't need to be. Seeing whether a number is a multiple of 2 or 5 is easy - you can just ...
Sara J's user avatar
  • 3,755
-7 votes
1 answer
182 views

No. Of Factors Does the Number Have [duplicate]

Create a function which takes in a input integer and then returns the number of factors it has, like if you pass 25 then it will return ...
Smilecat's user avatar
  • 155
14 votes
11 answers
850 views

Output Distinct Factor Cuboids

Output Distinct Factor Cuboids Today's task is very simple: given a positive integer, output a representative of each cuboid formable by its factors. Explanations A cuboid's volume is the product ...
lyxal's user avatar
  • 32.3k
29 votes
18 answers
4k views

Infinitely many primes

Since Euclid, we have known that there are infinitely many primes. The argument is by contradiction: If there are only finitely many, let's say \$p_1,p_2,...,p_n\$, then surely \$m:=p_1\cdot p_2\cdot.....
flawr's user avatar
  • 43.7k
9 votes
0 answers
262 views

Fastest way to iterate over sublattice of discrete lattice

I need to construct a functor that iterates over the linear representation of a sub-lattice of size \$d_x,d_y,d_z,d_q\$ embedded in a lattice of size \$n_x,n_y,n_z,n_q\$. The sub-lattice corner is ...
user3646557's user avatar
2 votes
1 answer
197 views

Find all diagonal counts in only one direction [closed]

If I need to get the number of diagonal squares in all directions: I do the following formula 2 N − 2 − |x − y| − |x + y − N − 1| The above example has 13 and ...
Ibrahim Ali's user avatar
38 votes
66 answers
10k views

Am I not good enough for you?

Background: The current Perfect Numbers challenge is rather flawed and complicated, since it asks you to output in a complex format involving the factors of the number. This is a purely decision-...
Jo King's user avatar
  • 47.1k
16 votes
12 answers
986 views

Generate some rough numbers

Background A number n can be described as B-rough if all of the prime factors of n strictly ...
Addison Crump's user avatar
22 votes
36 answers
3k views

Find the Squarish Root

Write code that when given a positive number \$x\$ as input, outputs the largest positive divisor of \$x\$ less than or equal to the square root of \$x\$. In other words find the largest \$n > 0\$ ...
Wheat Wizard's user avatar
  • 96.6k
16 votes
10 answers
2k views

Prime Factor Encoding

How the encoding works Given a list of bits: Hold a prime (starting with 2) Have a list For each bit in the input If it's the same as the previous bit, add the ...
Asone Tuhid's user avatar
  • 2,353
31 votes
10 answers
1k views

Find the dot product of Rationals

I was at a friend's house for dinner and they suggested the idea of a "Prime-factor vector space". In this space the positive integers are expressed as a vector such that the nth element in the ...
Wheat Wizard's user avatar
  • 96.6k
16 votes
7 answers
670 views

Queue Our Decomposition

In this challenge I will ask you to find a QR decomposition of a square matrix. The QR decomposition of matrix A is two Matrices Q and R such that A = QR. In particular we are looking for Q to be an ...
Wheat Wizard's user avatar
  • 96.6k
12 votes
6 answers
371 views

Primes ’n’ Digits

This has no practical purpose but it could be fun to golf. Challenge Given a number n, Count the amount of each digit in n and add 1 to each count Take the prime factorization of n Count the amount ...
RamenChef's user avatar
  • 1,214
21 votes
5 answers
812 views

Is my number Unique

In this challenge we learned a way to encode every positive integer using factor trees. Here is how it works: The empty string has value of 1. (S) where ...
Wheat Wizard's user avatar
  • 96.6k
20 votes
21 answers
2k views

Determine Superabundance

A superabundant number is an integer n that sets a new upper bound for its ratio with the divisor sum function σ. In other words, n is superabundant if and only if, for all positive integers x ...
Nissa's user avatar
  • 3,616
13 votes
7 answers
407 views

Encode Factor Trees [duplicate]

I once saw on the xkcd fora a format for expressing numbers in an odd way. In this "factor tree" format: The empty string is 1. Concatenation represents multiplication. A number n enclosed in ...
Nissa's user avatar
  • 3,616
22 votes
28 answers
2k views

Largest Prime Exponents

Given an integer n >= 2, output the largest exponent in its prime factorization. This is OEIS sequence A051903. Example Let ...
user avatar
28 votes
67 answers
3k 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 ...
Kevin Halley's user avatar
36 votes
11 answers
3k views

Encode an integer

Given positive integer n > 2. We convert it to an array as follows: If it is equal to 2 return an empty array Otherwise ...
user avatar
12 votes
7 answers
548 views

Number of sums of factors

Given a positive integer n > 1 determine how many numbers can be made by adding integers greater than 1 whose product is n. For example if n = 24 we can express n as a product in the following ways <...
Wheat Wizard's user avatar
  • 96.6k
7 votes
7 answers
529 views

Composite Factorization

This is similar to prime factorization, where you find the smallest prime factors of a number (i.e. 8 = 2 x 2 x 2). But this time, you are to return an array/list of the smallest composite factors of ...
Anthony Pham's user avatar
  • 1,961
34 votes
45 answers
3k views

Calculate the prime factors

We had a prime factorization challenge a while ago, but that challenge is nearly six years old and barely meets our current requirements, so I believe it's time for a new one. Challenge Write a ...
ETHproductions's user avatar
34 votes
14 answers
1k views

Generate n-ary numbers

A secondary number is a positive integer whose prime factors (without multiplicity) are all less than or equal to its square root. 4 is a secondary number, because ...
user avatar
21 votes
10 answers
2k views

Prime factors buddies

Given an integer N > 1, output all other numbers which prime decompositions have the same digits as the prime decomposition of ...
Fatalize's user avatar
  • 38.4k
14 votes
13 answers
841 views

Palindromic Prime Factors

Palindromic prime problems are pretty common, but that's not what this question is about. In this challenge, the number doesn't have to be a palindrome, its prime factors do. Task Your code has to ...
Maltysen's user avatar
  • 25.7k
23 votes
21 answers
2k views

Diamond Puzzles!

Explanation: Last year in math class, on homework we would occasionally get these extremely simple, although equally annoying questions called diamond puzzles. These were basically questions where we ...
Ashwin Gupta's user avatar
27 votes
17 answers
2k views

Sums of prime factors

2013 has the prime factorization 3*11*61. 2014 has the prime factorization 2*19*53. An interesting property regarding these ...
Arcturus's user avatar
  • 7,349
21 votes
9 answers
1k views

Novel Prime Factors of Repunits

The Background Folks were talking prime factorization in chat and we found ourselves talking about repunits. Repunits are a subset of the numbers known as repdigits, which are numbers consisting of ...
AdmBorkBork's user avatar
  • 43.3k
22 votes
3 answers
3k views

Factoring a 64-bit integer

Write a GOLF assembly program that reads an integer from stdin (followed by a trailing newline), and outputs its prime factors seperated by newlines, followed by a trailing newline on stdout. The ...
orlp's user avatar
  • 39k
24 votes
22 answers
10k views

Check if a number is a product of consecutive integer numbers

Some numbers such as: 6, 12, 20, 30, 42, 56, 60, 90, 120 and so on as can be expressed as a product of consecutive integer numbers as shown below. ...
Suraz's user avatar
  • 371
8 votes
3 answers
1k views

List prime-factorized natural numbers up to N in ascending order

For a given n list prime factorization of all natural numbers between 1 and n in ascending ...
Petr's user avatar
  • 4,362
24 votes
26 answers
3k views

Find the prime factors

In this task, you have to write a program, that computes the prime factors of a number. The input is a natural number 1 < n < 2^32. The output is a list of the prime factors of the number in the ...
FUZxxl's user avatar
  • 10.1k