Questions tagged [factoring]

"factoring" refers to the mathematical decomposition of integers into their factors

Factoring is operation of decomposing an object (typically an integer) into a product of other objects (typically its prime factors). It is also called "factorization"

52 questions
0
votes
2 answers

pollard rho algorithm in c++ never finds factors

I am trying to implement the pollard rho algorithm to factor large numbers. I am using the gmp package. The algorithm is taken from "Introduction to algorithms". The symptoms is that the while loop never breaks. My thoughts is that I am missing…
elemida
  • 9
  • 1
-1
votes
1 answer

How to create a Python program to factor simple trinomials

I'm trying to create a program that would be able to factor trinomials in the form x² + bx + c where b and c are integers, and outputs the factored form of the trinomial if it can be factored, or the statement, “This trinomial cannot be factored”…
-1
votes
2 answers

"Local variable referenced before assignment " appears when putting code into function

My code works fine until I try putting it into a function. Once I define the function, indent the code, and call the function, I get the error message: "Local variable 'print' referenced before assignment. Why is that popping up when all I'm…
tyklick
  • 3
  • 4
-2
votes
2 answers

Python script to find nth prime number

I'm new to Python and I thought I'd try to learn the ropes a bit by writing a function to find the nth prime number, however I can't get my code to work properly. No doubt this is due to me missing something fundamental, but I'd appreciate your help…
-3
votes
2 answers

Prime Factoring in Java - Intro Programming

Original: So for my intro to programming class, we have to find the prime factors of a range of numbers that the user inputs (i.e. 59-65). The issue with a lot of the solutions here is that they use things that we haven't discussed in class like…
Celli579
  • 1
  • 1
-3
votes
1 answer

Factoring expression completely

Can some one tell me if I got this right? Not fishing for the real answer if I got it wrong, just need to know if I did it right or need to try again. The book I'm working through for practice only has answers to odd numbered problems. Factor…
windy401
  • 195
  • 1
  • 6
-6
votes
1 answer

Find all the divisors of a number using Python

I am trying to write a Python script that will find prime numbers. In the way that I am going about this, the script is going to take a number from a range, determine the factors, determine if the only two factors are 1 and itself, and return true…
1 2 3
4