diff --git a/C#/1.Multiples_of_3_and_5/arya-prof.cs b/C#/1.Multiples_of_3_and_5/arya-prof.cs deleted file mode 100644 index e5b813c..0000000 --- a/C#/1.Multiples_of_3_and_5/arya-prof.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Euler 1 -using System; - -namespace _5_multiples -{ - public class MainClass - { - public static void Main() - { - int currentNumber = 1000; - int allSum = 0; - - currentNumber = currentNumber - 1; - while (currentNumber > 0) - { - if ( (currentNumber % 3 == 0) | (currentNumber % 5 == 0)) - { - allSum = allSum + currentNumber; - } - currentNumber = currentNumber - 1; - } - Console.WriteLine(allSum); - } - } -} diff --git a/Python/39. Integer right triangles/kohzhixin.py b/Python/39. Integer right triangles/kohzhixin.py new file mode 100644 index 0000000..73f2e5c --- /dev/null +++ b/Python/39. Integer right triangles/kohzhixin.py @@ -0,0 +1,16 @@ +""" +Problem 39 +""" + +def solution(max_p): + max_num = 0 + for p in range(0, max_p, 2): + c = 0 + for a in range(2, int(p/3)): + if (p**2 - 2*p*a) % (2 * (p-a)) == 0: + c += 1 + if c > max_num: + max_num = c + return max_num + +print(solution(1000)) \ No newline at end of file diff --git a/Python/43. Sub-string divisibility/kohzhixin.py b/Python/43. Sub-string divisibility/kohzhixin.py new file mode 100644 index 0000000..96de1e4 --- /dev/null +++ b/Python/43. Sub-string divisibility/kohzhixin.py @@ -0,0 +1,24 @@ +""" +Problem 43 +""" + +from itertools import permutations + +div = [2, 3, 5, 7, 11, 13, 17] + +def solution(): + total = 0 + for i in list(permutations([j for j in range(10)])): + if check_num(i): + total += int("".join([str(n) for n in i])) + return total + +def check_num(i): + for j in range(len(div)): + num = i[j+1] * 100 + i[j+2] * 10 + i[j+3] + if num % div[j] != 0: + return False + return True + + +print(solution()) \ No newline at end of file diff --git a/README.md b/README.md index ab26076..9ebcac9 100644 --- a/README.md +++ b/README.md @@ -68,11 +68,11 @@ Happy Contributing! 😃 | 36 | [Double-base palindromes](https://projecteuler.net/problem=36) | | | | | | | | | | | | | | 37 | [Truncatable primes](https://projecteuler.net/problem=37) | | | | | | | | | | | | | | 38 | [Pandigital multiples](https://projecteuler.net/problem=38) | | | | | | | | | | | | | -| 39 | [Integer right triangles](https://projecteuler.net/problem=39) | :white_check_mark: | :white_check_mark: | | | | | | | | | | | +| 39 | [Integer right triangles](https://projecteuler.net/problem=39) | :white_check_mark: | :white_check_mark: | | :white_check_mark: | | | | | | | | | | 40 | [Champernowne's constant](https://projecteuler.net/problem=40) | | | | :white_check_mark: | | | | | | | | | | 41 | [Pandigital prime](https://projecteuler.net/problem=41) | | | | :white_check_mark: | | | | | | | | | | 42 | [Coded triangle numbers](https://projecteuler.net/problem=42) | | | | :white_check_mark: | | | | | | | | | -| 43 | [Sub-string divisibility](https://projecteuler.net/problem=43) | | | | | | | | | | | | | +| 43 | [Sub-string divisibility](https://projecteuler.net/problem=43) | | | | :white_check_mark: | | | | | | | | | | 44 | [Pentagon numbers](https://projecteuler.net/problem=44) | | | | :white_check_mark: | | | | | | | | | | 45 | [Triangular, pentagonal, and hexagonal](https://projecteuler.net/problem=45) | | | | :white_check_mark: | | | | | | | | | | 46 | [Goldbach's other conjecture](https://projecteuler.net/problem=46) | | | | :white_check_mark: | | | | | | | | | @@ -81,9 +81,9 @@ Happy Contributing! 😃 | 49 | [Prime permutations](https://projecteuler.net/problem=49) | | | | :white_check_mark: | | | | | | | | | | 50 | [Consecutive prime sum](https://projecteuler.net/problem=50) | | | | :white_check_mark: | | | :white_check_mark: | | :white_check_mark: | | | | - ## Thanks + - Thanks to you all who are doing their best in solving the problems, we appriciate your efforts. - We thank you all for the overwelming P.R that we have recieved, To mantain the quality and response of the P.R we have updated the [guidelines](#How-to-contribute).