-
Notifications
You must be signed in to change notification settings - Fork 2
/
solution.java
41 lines (38 loc) · 899 Bytes
/
solution.java
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
package com.google.challenges;
public class Answer
{
//function for creating a string of prime numbers
public static String getPrime()
{
//declaration of variables
String rs= new String();
int i,j;
//stirng creation logic
for(i=2;i<30000;i++)
{
for(j=2;j<=i;j++)
{
if(i==j)
{
rs=rs+i;
}
if(i%j==0)
{
break;
}
}
}
return rs;
}
//function for returning unique id for each minion
public static String answer(int n)
{
//declaration of variables
String s = new String();
int i,j,k;
//id generation logic
s=getPrime();
String as= s.substring(n,n+5);
return as;
}
}