All Tracks Math Number Theory Problem

New Game
Tag(s):

Very-Easy

Problem
Editorial
Analytics

You have $$n$$ different numbers and you have to make all of them same by performing two operations.
Operation 1 : Pick a group of numbers and make them equal to any number which divides all of the numbers in that group but make sure you cant make the numbers equal to 1
Operation 2 : Pick a number and make it equal to 1
Find out minimum operations required to make all numbers equal.
Input
First line contains $$t$$ which is the total number of test cases. First line of the test case contains an integer $$N$$ as input. Next line contains $$N$$ integers.
Output
You have to provide minimum number of operations to make all the elements of array equal
Constraints
$$1\le N \le10^5$$
$$1\le A[i] \le10^6$$
$$1\le t \le10$$

SAMPLE INPUT
1
2
8 2
SAMPLE OUTPUT
1
Explanation

You can pick 8 and make it equal to 2 using operation 1 .Thus in total 1 operations you will get the new array as 2 2 and all elements are equal

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

IIIT Jabalpur

Challenge Name

CodeRing - III

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications