Combinatorics, Probability and Other Math Flashcards

1
Q

What’s special about pairs of numbers on each side of a triangular series?

A

They add up to the same value ex: 1, 2, 3, 4, 5, 6, 7, 8 pairs will always add up to 9

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

When adding pairs of numbers on each side of a triangular series, what is the value?

A

1 more than the series’ N ex: 1, 2, 3, 4, 5, 6, 7, 8; N is 8; value is always 9

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What’s the formula for calculating the sum of a triangular series

A

_sum = (n**2 + n)/2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does the modulo operator do? (ex 5 % 4)

A

Returns remainder from division 5 % 4 = 1 (4 goes in to 5 1 time with 1 remainder)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

10 % 4

A

2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

4 % 5

A

4

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What happens when the divisor is greater than the dividend in a modulo operation? (ex: 4 % 10)

A

The dividend is returned (4 % 10 = 4)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you truncate towards zero when dividing negatives in Python3?

A

int(5/-20) = 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly