diff --git a/coder07/ProjectEuler#1.java b/coder07/ProjectEuler#1.java new file mode 100644 index 0000000..b6dc191 --- /dev/null +++ b/coder07/ProjectEuler#1.java @@ -0,0 +1,24 @@ +import java.io.*; +import java.util.*; +import java.text.*; +import java.math.*; +import java.util.regex.*; + +public class Solution { + + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + int t = in.nextInt(); + for(int a0 = 0; a0 < t; a0++){ + long N = in.nextInt(); + long n=N-1; + long n3=n/3; + long s=n3*(3+(n3*3))/2; + long n5=n/5; + long s1=n5*(5+(n5*5))/2; + long n15=n/15; + long s2=n15*(15+(n15*15))/2; + System.out.println(s+s1-s2); + } + } +} diff --git a/coder07/ProjectEuler#2.java b/coder07/ProjectEuler#2.java new file mode 100644 index 0000000..549b43c --- /dev/null +++ b/coder07/ProjectEuler#2.java @@ -0,0 +1,29 @@ +import java.io.*; +import java.util.*; +import java.text.*; +import java.math.*; +import java.util.regex.*; + +public class Solution { + + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + int t = in.nextInt(); + for(int a0 = 0; a0 < t; a0++){ + long n = in.nextLong(); + long a=1,b=2,c,sum=2; + while(true) + { + c=a+b; + a=b; + b=c; + if(c>=n) + break; + if(c%2==0) + sum+=c; + } + System.out.println(sum); + + } + } +} \ No newline at end of file diff --git a/coder07/ProjectEuler#3.java b/coder07/ProjectEuler#3.java new file mode 100644 index 0000000..385e1da --- /dev/null +++ b/coder07/ProjectEuler#3.java @@ -0,0 +1,43 @@ +import java.io.*; +import java.util.*; +import java.text.*; +import java.math.*; +import java.util.regex.*; + +public class Solution { + + + public static void main(String[] args) { + + Scanner in = new Scanner(System.in); + int t = in.nextInt(); + for(int a0 = 0; a0 < t; a0++) + { + long n = in.nextLong(); + long pf=0,root,root2,loop,q,f; + root=(long)Math.sqrt(n); + for(long i=1;i<=n/2;i++) + { + f=0; + if(n%i==0) + { + q=n/i; + root2 = (long)Math.sqrt(q); + for(loop=2; loop<=root2;loop++) + { + if(q%loop==0) + f=1; + } + if(f==0) + { + System.out.println(q); + break; + } + } + + } + + + } + } +} \ No newline at end of file