Skip to content

added problem 39 in py3 #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions C#/1.Multiples_of_3_and_5/arya-prof.cs

This file was deleted.

16 changes: 16 additions & 0 deletions Python/39. Integer right triangles/kohzhixin.py
Original file line number Diff line number Diff line change
@@ -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))
24 changes: 24 additions & 0 deletions Python/43. Sub-string divisibility/kohzhixin.py
Original file line number Diff line number Diff line change
@@ -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())
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: | | | | | | | | |
Expand All @@ -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).
Expand Down