Combinatorics, Probability and Other Math Flashcards
What’s special about pairs of numbers on each side of a triangular series?
They add up to the same value ex: 1, 2, 3, 4, 5, 6, 7, 8 pairs will always add up to 9
When adding pairs of numbers on each side of a triangular series, what is the value?
1 more than the series’ N ex: 1, 2, 3, 4, 5, 6, 7, 8; N is 8; value is always 9
What’s the formula for calculating the sum of a triangular series
_sum = (n**2 + n)/2
What does the modulo operator do? (ex 5 % 4)
Returns remainder from division 5 % 4 = 1 (4 goes in to 5 1 time with 1 remainder)
10 % 4
2
4 % 5
4
What happens when the divisor is greater than the dividend in a modulo operation? (ex: 4 % 10)
The dividend is returned (4 % 10 = 4)
How do you truncate towards zero when dividing negatives in Python3?
int(5/-20) = 0