Skip to content

Commit

Permalink
Sphinx
Browse files Browse the repository at this point in the history
/home/docs/checkouts/readthedocs.org/user_builds/codewars/checkouts/latest/kyu_6/no_arithmetic_progressions/sequence.py:docstring of kyu_6.no_arithmetic_progressions.sequence.sequence:13: ERROR: Unexpected indentation.
/home/docs/checkouts/readthedocs.org/user_builds/codewars/checkouts/latest/kyu_6/no_arithmetic_progressions/sequence.py:docstring of kyu_6.no_arithmetic_progressions.sequence.sequence:14: WARNING: Block quote ends without a blank line; unexpected unindent.
  • Loading branch information
ikostan committed Aug 18, 2024
1 parent 4d52e2e commit cf4c0c9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
28 changes: 18 additions & 10 deletions kyu_6/no_arithmetic_progressions/sequence.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
"""
Solution for -> No arithmetic progressions
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""


def sequence(n: int) -> int:
Expand All @@ -13,13 +15,19 @@ def sequence(n: int) -> int:
form an arithmetic progression.
Example:
f(0) = 0 -- smallest non-negative
f(1) = 1 -- smallest non-negative, which is not yet in the sequence
f(2) = 3 -- since 0, 1, 2 form an arithmetic progression
f(3) = 4 -- neither of 0, 1, 4, 0, 3, 4, 1, 3, 4 form an arithmetic
progression, so we can take smallest non-negative, which is larger than 3
f(4) = 9 -- 5, 6, 7, 8 are not good, since 1, 3, 5, 0, 3, 6, 1, 4, 7, 0, 4, 8
are all valid arithmetic progressions.
f(0) = 0 -- smallest non-negative
f(1) = 1 -- smallest non-negative, which is not yet in the sequence
f(2) = 3 -- since 0, 1, 2 form an arithmetic progression
f(3) = 4 -- neither of 0, 1, 4, 0, 3, 4, 1, 3, 4 form an arithmetic
progression, so we can take smallest non-negative, which is larger than 3
f(4) = 9 -- 5, 6, 7, 8 are not good, since 1, 3, 5, 0, 3, 6, 1, 4, 7, 0, 4, 8
are all valid arithmetic progressions.
:param n:
:return:
"""
Expand Down
27 changes: 13 additions & 14 deletions kyu_6/no_arithmetic_progressions/test_sequence.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"""
Test for -> No arithmetic progressions
Testing sequence function
A function f(n), should returns the n-th member of sequence.
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""

# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/

# ALGORITHMS

import allure
Expand Down Expand Up @@ -45,16 +44,16 @@ def test_sequence(self):
"form an arithmetic progression.</p>")

test_data = (
(1233, 62047),
(0, 0),
(1, 1),
(2, 3),
(3, 4),
(4, 9),
(6541, 717373),
(7878, 790248),
(1435, 67909),
(6457, 715501)
(1233, 62047),
(0, 0),
(1, 1),
(2, 3),
(3, 4),
(4, 9),
(6541, 717373),
(7878, 790248),
(1435, 67909),
(6457, 715501)
)

for n, expected in test_data:
Expand Down

0 comments on commit cf4c0c9

Please sign in to comment.