-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDivisorExploration.java
More file actions
47 lines (41 loc) · 1.02 KB
/
DivisorExploration.java
File metadata and controls
47 lines (41 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class DivisorExploration {
static int divisorExploration(int m, int a, int d)
{
int n=1;
for(int i=1, p=2;i<=m;i++,p=nextPrime(p))
{
n=n*((int) Math.pow(p,a+i));
}
// Complete this function
}
static int nextPrime(int p)
{
int i=0;
for(int p1=p+1;true;p1++)
{
for( i=2;i<p1;i++)
{
if(p1%i==0)
break;
}
if(i==p1)
return p1;
}
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int q = in.nextInt();
for(int a0 = 0; a0 < q; a0++){
int m = in.nextInt();
int a = in.nextInt();
int d = in.nextInt();
int result = divisorExploration(m, a, d);
System.out.println(result);
}
}
}