Simple equation

kpinky
By kpinky

Is there any simple equation to express each number as a product of its prime for example take number 140 http://youtu.be/WiQUuN7EXYM i am looking for a simple method to solve it with out going through lengthy procedure

By anonymous• 12 Apr 2012 19:14
anonymous

thanks LP you too

By anonymous• 12 Apr 2012 19:13
anonymous

thwho, everybody (!) can have access to these things if they just would be interested. Have a nice weekend.

By anonymous• 12 Apr 2012 18:44
anonymous

QL's beaitful minds are LP and PG

By anonymous• 12 Apr 2012 16:47
Rating: 5/5
anonymous

This is easier but it takes longer:

Select a prime factor that your original number is divisible by and divide the original number by that prime factor. For example, if your original number equals 30, 2 is a prime factor so you would divide 30 by 2 to get 15.

Select a prime factor that the resulting number is divisible by and divide the new number by that prime factor. For this example, the new number equals 15. Because 3 is a prime factor, divide 15 by 3 to get 5.

Repeat Step 2 until you are left with a prime number. In this example, since 5 is a prime number, you would stop.

Write out the numbers you divided by and your last prime number to find the prime factorization. In this example, since you divided by 2, then 3 and were left with 5, your prime factors would be 2, 3 and 5.

By anonymous• 12 Apr 2012 16:43
Rating: 4/5
anonymous

You can use this VB macro in MS Excel:

Sub GetFactors()

Dim Count As Integer

Dim NumToFactor As Single 'Integer limits to < 32768

Dim Factor As Single

Dim y As Single

Dim IntCheck As Single

Count = 0

Do

NumToFactor = _

Application.InputBox(Prompt:="Type integer", Type:=1)

'Force entry of integers greater than 0.

IntCheck = NumToFactor - Int(NumToFactor)

If NumToFactor = 0 Then

Exit Sub

'Cancel is 0 -- allow Cancel.

ElseIf NumToFactor < 1 Then

MsgBox "Please enter an integer greater than zero."

ElseIf IntCheck > 0 Then

MsgBox "Please enter an integer -- no decimals."

End If

'Loop until entry of integer greater than 0.

Loop While NumToFactor 0

For y = 1 To NumToFactor

'Put message in status bar indicating the integer being checked.

Application.StatusBar = "Checking " & y

Factor = NumToFactor Mod y

'Determine if the result of division with Mod is without _

remainder and thus a "factor".

If Factor = 0 Then

'Enter the factor into a column starting with the active cell.

ActiveCell.Offset(Count, 0).Value = y

'Increase the amount to offset for next value.

Count = Count + 1

End If

Next

'Restore Status Bar.

Application.StatusBar = "Ready"

End Sub

Sub GetPrime()

Dim Count As Integer

Dim BegNum As Single 'Integer limits to < 32768

Dim EndNum As Single

Dim Prime As Single

Dim flag As Integer

Dim IntCheck As Single

Count = 0

Do

BegNum = _

Application.InputBox(Prompt:="Type beginning number.", Type:=1)

'Force entry of integers greater than 0.

IntCheck = BegNum - Int(BegNum)

If BegNum = 0 Then

Exit Sub

'Cancel is 0 -- allow Cancel.

ElseIf BegNum < 1 Then

MsgBox "Please enter an integer greater than zero."

ElseIf IntCheck > 0 Then

MsgBox "Please enter an integer -- no decimals."

End If

'Loop until entry of integer greater than 0.

Loop While BegNum 0

Do

EndNum = _

Application.InputBox(Prompt:="Type ending number.", Type:=1)

'Force entry of integers greater than 0.

IntCheck = EndNum - Int(EndNum)

If EndNum = 0 Then

Exit Sub

'Cancel is 0 -- allow Cancel.

ElseIf EndNum < BegNum Then

MsgBox "Please enter an integer larger than " & BegNum

ElseIf EndNum < 1 Then

MsgBox "Please enter an integer greater than zero."

ElseIf IntCheck > 0 Then

MsgBox "Please enter an integer -- no decimals."

End If

'Loop until entry of integer greater than 0.

Loop While EndNum < BegNum Or EndNum 0

For y = BegNum To EndNum

flag = 0

z = 1

Do Until flag = 1 Or z = y + 1

'Put message into Status Bar indicating the integer and _

divisor in each loop.

Application.StatusBar = y & " / " & z

Prime = y Mod z

If Prime = 0 And z y And z 1 Then

flag = 1

End If

z = z + 1

Loop

If flag = 0 Then

'Enter the factor into a column starting with the active cell.

ActiveCell.Offset(Count, 0).Value = y

'Increase the amount to offset for next value.

Count = Count + 1

End If

Next y

'Restore Status Bar.

Application.StatusBar = "Ready"

End Sub

By anonymous• 12 Apr 2012 15:56
Rating: 5/5
anonymous

or a simple equation :

First have a list of all Prime numbers : 2, 3, 5, 7, 11, 13, etc..

If number is 140 for example: then you only need to have all prime numbers before 70. (2,3,5,7,11,13, etc until 67)

Now: start from the end of this list and Divide 140 by the first one in this list and when you are able to divide it and get a 0 for remainder, then stop and you will have your first product.

140/7 = 20

so 140 = 7 x "20".

Now take 20 and do same thing you did for 140.

(find all prime numbers till half of 20) = (2,3,5,7)

20/7 = has non zero remainder, so

20/5 = has zero remainder then

20 = 5 x "4"

140 = 7 x 5 x "4"

Now do same for "4" and you will get 4 = 2 x 2

and the "2" will be 2 X 1

----------------------------------------

So your end will be 140 = 7 x 5 x 2 x 2

By cherukkan• 12 Apr 2012 15:55
cherukkan

PeterGriffin, Is that the simple equation?

By anonymous• 12 Apr 2012 15:42
Rating: 4/5
anonymous

Input is X

If X is prime number Then

IF dynamic_new_Array[0] Null then

For (P=counter, Counter>=1, counter--)

Return dynamic_new_Array[counter]

By cherukkan• 12 Apr 2012 15:07
cherukkan

Sorry, I cannot open the link. What is your question? 140 is not a prime number.

By nabunabeeb• 12 Apr 2012 15:04
nabunabeeb

is there a link...i cannot even see it...:)

By britexpat• 12 Apr 2012 13:23
britexpat

Because it;s a question that was given as homework in a school in Qatar..

(has to be answered and handed in by Sunday)

By smoke• 12 Apr 2012 13:21
smoke

How is this question related with anything to Qatar?

By Baburao-Ganpatrao-Apte• 12 Apr 2012 13:17
Baburao-Ganpatrao-Apte

lol :P

By anonymous• 12 Apr 2012 13:16
anonymous

but im afraid we must call an ambulance first just in case

By Baburao-Ganpatrao-Apte• 12 Apr 2012 13:10
Baburao-Ganpatrao-Apte

i think LP can answer this

By anonymous• 12 Apr 2012 13:10
anonymous

me too

By Baburao-Ganpatrao-Apte• 12 Apr 2012 13:08
Baburao-Ganpatrao-Apte

hi thewho i already lost conscious after reading the question :(

By anonymous• 12 Apr 2012 13:03
anonymous

Ask baburao, he knows the answer

Log in or register to post comments

More from Qatar Living

Qatar’s top beaches for water sports thrills

Qatar’s top beaches for water sports thrills

Let's dive into the best beaches in Qatar, where you can have a blast with water activities, sports and all around fun times.
Most Useful Apps In Qatar - Part Two

Most Useful Apps In Qatar - Part Two

This guide brings you the top apps that will simplify the use of government services in Qatar.
Most Useful Apps In Qatar - Part One

Most Useful Apps In Qatar - Part One

this guide presents the top must-have Qatar-based apps to help you navigate, dine, explore, access government services, and more in the country.
Winter is coming – Qatar’s seasonal adventures await!

Winter is coming – Qatar’s seasonal adventures await!

Qatar's winter months are brimming with unmissable experiences, from the AFC Asian Cup 2023 to the World Aquatics Championships Doha 2024 and a variety of outdoor adventures and cultural delights.
7 Days of Fun: One-Week Activity Plan for Kids

7 Days of Fun: One-Week Activity Plan for Kids

Stuck with a week-long holiday and bored kids? We've got a one week activity plan for fun, learning, and lasting memories.
Wallet-friendly Mango Sticky Rice restaurants that are delightful on a budget

Wallet-friendly Mango Sticky Rice restaurants that are delightful on a budget

Fasten your seatbelts and get ready for a sweet escape into the world of budget-friendly Mango Sticky Rice that's sure to satisfy both your cravings and your budget!
Places to enjoy Mango Sticky Rice in  high-end elegance

Places to enjoy Mango Sticky Rice in high-end elegance

Delve into a world of culinary luxury as we explore the upmarket hotels and fine dining restaurants serving exquisite Mango Sticky Rice.
Where to celebrate World Vegan Day in Qatar

Where to celebrate World Vegan Day in Qatar

Celebrate World Vegan Day with our list of vegan food outlets offering an array of delectable options, spanning from colorful salads to savory shawarma and indulgent desserts.