answersLogoWhite

0


Best Answer

The simple (brute-force) way to do it would be something like this:

For every integer i from 2 to n-1 do:

If n modulo i equals 0, output i.

This would be very slow for large n (linear in the size of n, in the best case).

User Avatar

Wiki User

16y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the pseudo-code for finding all the factors of a positive integer?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Design an algorithm for finding all the factors of positive integerfor example in the case of the integer 12your algorithm should report 12346 and 12?

design an algorithm for finding all the factors of a positive integer


What are the numbers that are not prime or composite?

A prime number is a number with two positive integer factors, while a composite number has more than two positive integer factors. Since the number 0 has no positive integer factors, and the number 1 has just one positive integer factor (itself), neither of these are prime.


What are the factors of 18 and 7?

The positive integer factors of 18 are: 1 2 3 6 9 18 The positive integer factors of 7 are: 1 7 Since 7 is a prime number, the only positive integer common factors of the two numbers is the number 1.


What are the factors of 1941?

The positive integer factors of 1941 are: 1, 3, 647, 1941 The prime factors are 3 and 647.


What are the factors of 419?

The positive integer factors of 419 are: 1, 419


What are the factors of 439?

The positive integer factors of 439 are: 1, 439


What are the factors of 509?

The positive integer factors of 509 are: 1, 509


What are the factors of 521?

The positive integer factors of 521 are: 1, 521


What are the factors of 1949?

The positive integer factors of 1949 are: 1, 1949


What are the factors of 1933?

The positive integer factors of 1933 are: 1, 1933


What are the factors of 1019?

The positive integer factors of 1019 are: 1, 1019


What are the factors of 431?

The positive integer factors of 431 are: 1, 431