@_mainack BinSearch for new p which is smallest prime > i
So this algorithm runs in n log log n because of the sieve.
The main loop achieves the linear lower bound. So if anyone has a better prime finding algorithm this will improve.
@_mainack If memory is not a problem, sieve of Erastothenes will give you prime numbers in n log log n time.
Find and save a list of primes [2, p] such that p is the smallest prime larger than 2n.
Let i = 2n, p = p
While i > 0:
Add sets (i, p-i), (i -1, p-i + 1) …
i = p - i - 1
In State Machine Replication, is the State Machine model a Turing Machine? Are there benefits (eg, cheaper protocols) if we weaken this model to something like a pushdown automata or finite state machine?
@PicturesFoIder 4C2 = 6 pairs of points in each parallel line. A triangle is formed with top vertex and one such pair of point. 4 parallel lines are present. So 6*4 = 24 triangles.
Dear Kgpians,
Do you enjoy solving problems through code? Or do you enjoy talking about something you have learned? If yes, then you will want to attend the introductory seminar of the Kharagpur Open Source Society (KOSS).
When professors said to free every malloc, we used to just ignore😅.
Now the same principle came back to bite me while programming on enclaves/limited memory systems.
Use smart pointers guys!
Gave a one-hour talk on FLP theorem (part of a 3hr lecture with 2 other classmates).
Here are the slides: https://t.co/r7tUOulI4V
Based on 3 part blog post by @ittaia.