mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			37 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给你一个正整数数组 <code>nums</code> ,对 <code>nums</code> 所有元素求积之后,找出并返回乘积中 <strong>不同质因数</strong> 的数目。</p>
 | 
						||
 | 
						||
<p><strong>注意:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li><strong>质数</strong> 是指大于 <code>1</code> 且仅能被 <code>1</code> 及自身整除的数字。</li>
 | 
						||
	<li>如果 <code>val2 / val1</code> 是一个整数,则整数 <code>val1</code> 是另一个整数 <code>val2</code> 的一个因数。</li>
 | 
						||
</ul>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>示例 1:</strong></p>
 | 
						||
 | 
						||
<pre><strong>输入:</strong>nums = [2,4,3,7,10,6]
 | 
						||
<strong>输出:</strong>4
 | 
						||
<strong>解释:</strong>
 | 
						||
nums 中所有元素的乘积是:2 * 4 * 3 * 7 * 10 * 6 = 10080 = 2<sup>5</sup> * 3<sup>2</sup> * 5 * 7 。
 | 
						||
共有 4 个不同的质因数,所以返回 4 。
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 2:</strong></p>
 | 
						||
 | 
						||
<pre><strong>输入:</strong>nums = [2,4,8,16]
 | 
						||
<strong>输出:</strong>1
 | 
						||
<strong>解释:</strong>
 | 
						||
nums 中所有元素的乘积是:2 * 4 * 8 * 16 = 1024 = 2<sup>10</sup> 。
 | 
						||
共有 1 个不同的质因数,所以返回 1 。</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li><code>1 <= nums.length <= 10<sup>4</sup></code></li>
 | 
						||
	<li><code>2 <= nums[i] <= 1000</code></li>
 | 
						||
</ul>
 |