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).
yea me too dude. Mahleko :(
Having an unsigned integer means that the integer is positive, and not negative; literally, the integer is unsigned and assumed to be positive. The unsigned integer 8 is positive-eight, not negative-eight.
Store the absolute value of the desired integer in a variable. Multiply the absolute value by two. Substract the new integer by the old integer.
signed integer means that it has a sigh (+ or -). Using another words you say that signed variable can be positive as well as negative. unsigned variables can be only positive.
No. They are unsigned, therefore all representations are positive.
design an algorithm for finding all the factors of a positive integer
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.
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.
The positive integer factors of 1941 are: 1, 3, 647, 1941 The prime factors are 3 and 647.
The positive integer factors of 419 are: 1, 419
The positive integer factors of 439 are: 1, 439
The positive integer factors of 509 are: 1, 509
The positive integer factors of 521 are: 1, 521
The positive integer factors of 1949 are: 1, 1949
The positive integer factors of 1933 are: 1, 1933
The positive integer factors of 1019 are: 1, 1019
The positive integer factors of 431 are: 1, 431