Question 51
MediumWhat is 17²ā°Ā²ā“ mod 10 (its last digit)?
- A.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Data Structures and Algorithms
What is 17²ā°Ā²ā“ mod 10 (its last digit)?
9
3
7
1
Sign up free to see the answer and a step-by-step explanation.
By Fermat's little theorem, what is 5¹ā°ā° mod 101?
100
5
0
1
Sign up free to see the answer and a step-by-step explanation.
How many numbers from 1 to 1000 are coprime to 1000?
500
250
600
400
Sign up free to see the answer and a step-by-step explanation.
Why is the sieve of Eratosthenes allowed to start crossing out multiples of p from p²?
Multiples below p² are prime
p² is always prime
Smaller multiples of p have a smaller prime factor and were already crossed out
It is faster to start at 2p
Sign up free to see the answer and a step-by-step explanation.
What is the output of this code?
n, res, p = 12, 12, 2
m = n
while p * p <= m:
if m % p == 0:
while m % p == 0:
m //= p
res -= res // p
p += 1
if m > 1:
res -= res // m
print(res)
6
2
Sign up free to see the answer and a step-by-step explanation.
By Fermat's little theorem, what is the modular inverse of a modulo a prime p (a not divisible by p)?
a^(pā2) mod p
p ā a
a^(pā1) mod p
a mod p
Sign up free to see the answer and a step-by-step explanation.
What is the output of this code?
def egcd(a, b):
if b == 0:
return a, 1, 0
g, x, y = egcd(b, a % b)
return g, y, x - (a // b) * y
print(egcd(4, 6))
(1, 0, 1)
(2, 2, -1)
Sign up free to see the answer and a step-by-step explanation.
What is the last digit of 3^2025?
1
7
3
9
Sign up free to see the answer and a step-by-step explanation.
What is the output of this code?
n, k = 5, 2
C = [[0] * (k + 1) for _ in range(n + 1)]
for i in range(n + 1):
for j in range(min(i, k) + 1):
C[i][j] = 1 if j in (0, i) else C[i-1][j-1] + C[i-1][j]
print(C[n][k])
120
20
Sign up free to see the answer and a step-by-step explanation.
How many positive divisors does 360 have?
36
20
18
24
Sign up free to see the answer and a step-by-step explanation.
8
4
(2, -1, 1)
(2, 1, -1)
10
5