We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4652400 + 4bef8cb commit 6d2ad66Copy full SHA for 6d2ad66
math/lucky_numbers.py
@@ -0,0 +1,15 @@
1
+def generate_lucky_number_sequence(end):
2
+
3
+ #create a list of all odd numbers up to the final number
4
+ sequence = [*range(1, end+1, 2)]
5
6
+ #remove every xth number from the list where x = the nth element of the sequence
7
+ n = 1
8
+ while len(sequence) > sequence[n]:
9
+ number_to_delete = sequence[n]
10
+ del sequence[number_to_delete-1::number_to_delete]
11
+ n = n + 1
12
13
+ return sequence
14
15
+print(generate_lucky_number_sequence(int(input("Please enter the upper bound of the lucky number sequence: "))))
0 commit comments