# Write a c program to find the largest prime factor of a number

The prime factors of 13195 are 5,7,13,& 29...so 29 is the largest prime factor of 13195. what is the largest prime factor of the number 600851475143?

Posted by on

• Level 2:

An expert who has achieved level 2 by getting 100 points

MVP:

An expert that got 5 achievements.

Sergeant:

An expert that has over 500 points.

Champion:

An expert who has answered 200 questions.

• Expert

#include<stdio.h>
#include<conio.h>
void main()
{
int num,i=1,j,k;
clrscr();
printf("\nEnter a number:");
scanf("%d",&num);
while(i<=num)
{
k=0;
if(num%i==0)
{
j=1;
while(j<=i)
{
if(i%j==0)
k++; j++;
}
if(k==2)
printf("\n%d is a prime factor",i);
}
i++;
}
getch();
}

Posted on May 16, 2009

Hi there,
Save hours of searching online or wasting money on unnecessary repairs by talking to a 6YA Expert who can help you resolve this issue over the phone in a minute or two.

Best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.

Here's a link to this great service

Good luck!

Posted on Jan 02, 2017

×

my-video-file.mp4

×

## Related Questions:

### What is a prime factor

A factor that is a prime number. Any of the prime numbers that, when multiplied, give the original number. Example: Theprime factors of 15 are 3 and 5 (3×5=15, and 3 and 5 areprime numbers).

Jun 15, 2017 | Prime Computers & Internet

### Number 2 is chosen to begin a ladder diagram to find the prime factorization of 66. What other numbers could have been used to start the ladder diagram of 66?

By changing the number for your prime factorization, you also have a different diagram.

Prime factorization for 66

66
/\
2*33
/\
3*11

Even if we change the prime factorization order, we still have the same numbers.

66 = 2 * 3 * 11

Feb 23, 2017 | Cars & Trucks

### How do I get all the factors of a constant using my calculator?

There is a program on page 253 of the manual (http://support.casio.com/manualfile.php?rgn=5&cid=004002013) to get the prime factors of any number. You could modify the program to get all the factors.

Another way would be to do it manually. I start with the number 1 and go up to the square root of the number. The square root of 120 is 10.95, so let's go up to 11. Using 120 as an example:

120 /1 = 120 thus factor is (1, 120)
120/2 = 60 thus factor is (2, 60)
120/3 = 40 thus factor is (3, 40)
120/4 = 30 thus factor is (4, 30)
120/5 = 24 thus factor is (5, 24)
120/6 = 20 thus factor is (6, 20)
120/7 = 1.7 thus 7 not a factor
120/8 = 15 thus factor is (8,15)
120/9 = 13.3 thus 9 is not a factor
120/10 = 12 thus factor is (10,12)
120/11 = 10.9 thus 11 is not a factor.

Good luck.

Paul

Jul 05, 2015 | Casio FX-9750GII Graphing Calculator

### I try to find LCM but keep getting error

I do not think that the FX115ES can give you the prime factor decomposition of a number. The FX115ES Plus may do it.
On the FX991 ES Plus there is key marked FACT.. It is the one between the Change sign key (-) and the HYPerbolic key.
I am afraid you will have to do the decomposition of the two numbers by hand. For example
1440=(2^5)(3^2)(5)
700=(2^2)(5^2)(7)
By multiplying the two number you can get a multiple of both but it won't be the smallest.
What you do is scan the two decompositions to identify the various prime factors, 2,3,5, 7
All those factors must be present in the LCM. For each prime factor, select the largest exponent . This is going to be 5 for factor 2, 2 for factor 3, 2 for factor 5, and 1 for factor 7
Hence LCM(1440,700)= (2^5)(3^2)(5^2)(7^1)=50400
Verify that 50400/1440=35 and 50400/700=72

Sep 22, 2014 | Casio FX-115ES Scientific Calculator

### My casio fx-83GT Plus calculator wont do HCF for me

There is nothing you can do to make the calculator find the HCF for you. No point complaining about that. But if you are interested in doing it by hand (using the calculator to do the divisions for you) here how it is done.
1. Decompose the first number in prime factors. If a prime factor is repeated use the exponent notation: That helps.
2. Decompose the second number in prime factors too, using the exponent notation.
3. Now look at the two decompositions. If a prime factor is present in both decompositions it must be in the HCD /HCF, with the smallest of its two exponents.
4. Do that for all prime factors
Example: Here are the decompositions of two numbers
(2^5)*3*(5^4)(7^3)*11 and (2^3)*(5^6)*(11^2)*7
The prime factors that are present in both decompositions are
2, 5, 7, and 11
From the two decompositions select the smallest power of each common prime factor. They are represented in bold fonts.
2^3, 5^4, 7, 11
The highest common divisor/Highest common factor is
(2^3)*(5^4)*7*11

Mar 27, 2014 | Casio Office Equipment & Supplies

### How do i factor numbers on a ti-30xs calculator

This calculator does not have a key that you can use to find the prime factor of an integer.
You can however use the calculator to find the factors
1. If number is even divide it by 2
Keep dividing by 2, while keeping track of how many times you divided by 2.
If you divided 5 times by 2 before getting an odd number, then your first factor is 2^5
2. Now try dividing by 3, keep track of the number of times you divided by 3 before you could not divide by 3 any more. If you divided 0 times by 3, your second factor is 3^0, or 1 and 3 is not a factor.
If you divided 4 times by 3, your second factor is 3^4
3. Divide by 5, until you can't any more. Keep track of the number of times you divided by 5.
4. Divide by all other prime numbers 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, etc. For each prime number, keep track of how many times you divided by it, until you could not any more.

Example: 23100
Division by 2
23100/2=11550 ---------> 1 division by 2
11550/2=5775 ----------> 2 divisions by 2
Note that 5775 is not divisible by 2. No more divisions by 2.
First factor is 2^2

Division by 3:
5775/3=1925 ----------> 1 division by 3
1925/3=641. 66667 Not an integer. No more divisions by 3.
2nd factor is 3^1

Division by 5 (number ends in 5)
1925/5 =385 -------> 1 division by 5
385/5=77 ----------> 2 divisions by 5 and no more (quotient does not end in 0 or 5)
3rd factor is 5^2

Division by 7
77/7=11 --------> 1 division by 7, and no more
4th factor is 7^1=7

Division by 11
11/11=1
5th factor is 11^1=11

Assembling the factors 2^2, 3^1, 5^2, 7, 11
Prime factorization of 23100 is
23100=(2^2)(3)(5^2)(7)11

Dec 18, 2013 | Texas Instruments TI-30XA Calculator

### What is prime factorization?

"Prime Factorization" is finding which prime numbers multiply together to make the original number.

Example : What are the prime factors of 12 ? It is best to start working from the smallest prime number, which is 2, so let's check:

12 ÷ 2 = 6
Yes, it divided evenly by 2. We have taken the first step!
But 6 is not a prime number, so we need to go further. Let's try 2 again:

6 ÷ 2 = 3
Yes, that worked also. And 3 is a prime number, so we have the answer:

12 = 2 × 2 × 3

As you can see, every factor is a prime number, so the answer must be right.

Note: 12 = 2 × 2 × 3 can also be written using exponents as 12 = 22 × 3

Jun 22, 2011 | Computers & Internet

### Find the prime number between 1 to 50

using System;

class MainClass {
public static void Main() {
int num;
int i;
int factor;
bool isprime;

for(num = 1; num < 50; num++) {
isprime = true;
factor = 0;

// see if num is evenly divisible
for(i=2; i <= num/2; i++) {
if((num % i) == 0) {
// num is evenly divisible -- not prime
isprime = false;
factor = i;
}
}

if(isprime)
Console.WriteLine(num + " is prime.");
else
Console.WriteLine("Largest factor of " + num +
" is " + factor);
}

}
}

Feb 01, 2011 | Computers & Internet

#### Related Topics:

396 people viewed this question

Level 3 Expert

Level 3 Expert