kyu_6.no_arithmetic_progressions package
Submodules
kyu_6.no_arithmetic_progressions.sequence module
Solution for -> No arithmetic progressions.
Created by Egor Kostan. GitHub: https://github.com/ikostan
- kyu_6.no_arithmetic_progressions.sequence.general_term_of_arithmetic_progression(a: int, dif: int, terms: int = 3) int[source]
General Term of an Arithmetic Progression.
- Parameters:
a
dif
terms
- Returns:
- kyu_6.no_arithmetic_progressions.sequence.sequence(n: int) int[source]
Return the n-th member of sequence.
Consider a sequence, which is formed by the following rule: next term is taken as the smallest possible non-negative integer, which is not yet in the sequence, so that no 3 terms of sequence 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.
- Parameters:
n
- Returns:
kyu_6.no_arithmetic_progressions.test_sequence module
Test for -> No arithmetic progressions.
Created by Egor Kostan. GitHub: https://github.com/ikostan
- class kyu_6.no_arithmetic_progressions.test_sequence.SequenceTestCase(methodName='runTest')[source]
Bases:
TestCaseTesting sequence function.
- _classSetupFailed = False
- _class_cleanups = []
- pytestmark = [Mark(name='skip', args=(), kwargs={'reason': 'The solution is not ready'})]
- test_sequence = None
- test_sequence_0(**kw)
A function f(n), should return the n-th member of sequence [with n=1233, expected=62047].
- Returns:
- test_sequence_1(**kw)
A function f(n), should return the n-th member of sequence [with n=0, expected=0].
- Returns:
- test_sequence_2(**kw)
A function f(n), should return the n-th member of sequence [with n=1, expected=1].
- Returns:
- test_sequence_3(**kw)
A function f(n), should return the n-th member of sequence [with n=2, expected=3].
- Returns:
- test_sequence_4(**kw)
A function f(n), should return the n-th member of sequence [with n=3, expected=4].
- Returns:
- test_sequence_5(**kw)
A function f(n), should return the n-th member of sequence [with n=4, expected=9].
- Returns:
- test_sequence_6(**kw)
A function f(n), should return the n-th member of sequence [with n=6541, expected=717373].
- Returns:
- test_sequence_7(**kw)
A function f(n), should return the n-th member of sequence [with n=7878, expected=790248].
- Returns:
- test_sequence_8(**kw)
A function f(n), should return the n-th member of sequence [with n=1435, expected=67909].
- Returns:
- test_sequence_9(**kw)
A function f(n), should return the n-th member of sequence [with n=6457, expected=715501].
- Returns:
Module contents
No arithmetic progressions.