aboutsummaryrefslogtreecommitdiff
path: root/challenge-009/paulo-custodio/python/ch-1.py
blob: 2482dae8c68a1495d7df37ed52a5ca96ce8c7349 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/python3

# Challenge 009
#
# Challenge #1
# Write a script that finds the first square number that has at least 5 distinct
# digits. This was proposed by Laurent Rosenfeld.

import sys

def num_diff_digits(n):
    return len(set([x for x in str(n)]))

min_diff_digits = int(sys.argv[1])
n = 1
while num_diff_digits(n*n) < min_diff_digits:
    n += 1
print(n*n)