The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 5 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
We all know that our friend Bheem likes gcd of numbers very much. One day Kaalia challenged him with a new problem with gcd. He gave Bheem N numbers and asked to divide the given set of numbers into some disjoint subsequences. Two numbers a and b belong to same subsequence if gcd(a,b)>1. Value of each subsequence is the largest number in that subsequence. He challenged Bheem to find the product of values of all subsequences.
Help Bheem win this challenge.
Note: if gcd(a,b) >1, gcd (b,c) >1 then a,b,c will be in same subsequence even if gcd(a,c) = 1.
Â
Â
Â
Â
Â
Â
Â
Â
Â
Â
Â
Input: 2 4 2 4 3 9 3 2 3 6 Output: 36 6
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll