@@ -4,36 +4,36 @@ namespace algorithm_exercises_csharp.hackerrank.prohecteuler;
4
4
5
5
using System . Diagnostics . CodeAnalysis ;
6
6
7
- public class Euler001Problem
7
+ public class Euler001
8
8
{
9
9
[ ExcludeFromCodeCoverage ]
10
- protected Euler001Problem ( ) { }
10
+ protected Euler001 ( ) { }
11
11
12
- public static int SuOfArithmeticProgression ( int n , int d )
12
+ public static int sumOfArithmeticProgression ( int n , int d )
13
13
{
14
14
int new_n = n / d ;
15
15
16
16
return new_n * ( 1 + new_n ) * d / 2 ;
17
17
}
18
18
19
- public static int GCD ( int u , int v )
19
+ public static int gcd ( int u , int v )
20
20
{
21
21
if ( v != 0 )
22
22
{
23
- return GCD ( v , u % v ) ;
23
+ return gcd ( v , u % v ) ;
24
24
}
25
25
return u ;
26
26
}
27
27
28
28
// Function to find the sum of all multiples of a and b below n
29
- public static int Euler001 ( int a , int b , int n )
29
+ public static int euler001 ( int a , int b , int n )
30
30
{
31
31
// Since, we need the sum of multiples less than N
32
32
int new_n = n - 1 ;
33
- int lcm = a * b / GCD ( a , b ) ;
33
+ int lcm = a * b / gcd ( a , b ) ;
34
34
35
- return SuOfArithmeticProgression ( new_n , a ) +
36
- SuOfArithmeticProgression ( new_n , b ) -
37
- SuOfArithmeticProgression ( new_n , lcm ) ;
35
+ return sumOfArithmeticProgression ( new_n , a ) +
36
+ sumOfArithmeticProgression ( new_n , b ) -
37
+ sumOfArithmeticProgression ( new_n , lcm ) ;
38
38
}
39
39
}
0 commit comments