Skip to content

Commit 3bff196

Browse files
authored
Fix some typos in solution 1 of euler 686 (#6112)
While reading this code I noticed some typos in the doc strings and wanted to fix them.
1 parent 8226636 commit 3bff196

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: project_euler/problem_686/sol1.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def log_difference(number: int) -> float:
2727
Computing 2^90 is time consuming.
2828
Hence we find log(2^90) = 90*log(2) = 27.092699609758302
2929
But we require only the decimal part to determine whether the power starts with 123.
30-
SO we just return the decimal part of the log product.
30+
So we just return the decimal part of the log product.
3131
Therefore we return 0.092699609758302
3232
3333
>>> log_difference(90)
@@ -57,14 +57,14 @@ def solution(number: int = 678910) -> int:
5757
5858
So if number = 10, then solution returns 2515 as we observe from above series.
5959
60-
Wwe will define a lowerbound and upperbound.
60+
We will define a lowerbound and upperbound.
6161
lowerbound = log(1.23), upperbound = log(1.24)
6262
because we need to find the powers that yield 123 as starting digits.
6363
6464
log(1.23) = 0.08990511143939792, log(1,24) = 0.09342168516223506.
6565
We use 1.23 and not 12.3 or 123, because log(1.23) yields only decimal value
6666
which is less than 1.
67-
log(12.3) will be same decimal vale but 1 added to it
67+
log(12.3) will be same decimal value but 1 added to it
6868
which is log(12.3) = 1.093421685162235.
6969
We observe that decimal value remains same no matter 1.23 or 12.3
7070
Since we use the function log_difference(),
@@ -87,7 +87,7 @@ def solution(number: int = 678910) -> int:
8787
Hence to optimize the algorithm we will increment by 196 or 93 depending upon the
8888
log_difference() value.
8989
90-
Lets take for example 90.
90+
Let's take for example 90.
9191
Since 90 is the first power leading to staring digits as 123,
9292
we will increment iterator by 196.
9393
Because the difference between any two powers leading to 123
@@ -99,15 +99,15 @@ def solution(number: int = 678910) -> int:
9999
The iterator will now become 379,
100100
which is the next power leading to 123 as starting digits.
101101
102-
Lets take 1060. We increment by 196, we get 1256.
102+
Let's take 1060. We increment by 196, we get 1256.
103103
log_difference(1256) = 0.09367455396034,
104104
Which is greater than upperbound hence we increment by 93. Now iterator is 1349.
105105
log_difference(1349) = 0.08946415071057 which is less than lowerbound.
106106
The next power is 1545 and we need to add 196 to get 1545.
107107
108108
Conditions are as follows:
109109
110-
1) If we find a power, whose log_difference() is in the range of
110+
1) If we find a power whose log_difference() is in the range of
111111
lower and upperbound, we will increment by 196.
112112
which implies that the power is a number which will lead to 123 as starting digits.
113113
2) If we find a power, whose log_difference() is greater than or equal upperbound,

0 commit comments

Comments
 (0)