Handmade almost integer sequence. Part 01.
Handmade almost integer sequence. Part 01. Where were we? Ah, OK. What about 1+2. Following the pattern, let's consider 1−2. The sum of these two numbers is 2 and product is -1. So, they are
EN / RU
Handmade almost integer sequence. Part 01. Where were we? Ah, OK. What about 1+2. Following the pattern, let's consider 1−2. The sum of these two numbers is 2 and product is -1. So, they are
Or is it too late? I came across a line in a chat. It went something like “An LLM proved the Riemann hypothesis, and humans didn’t.” My first thought was, one LLM? I’d bet on a swarm of agents working together. My next t
Photo shared on November 22, 2026
Handmade almost integer sequence. Part 00. Let's get back on track. My train of thought was: row of Pascal's triangle in linear time; O(n) for Fibonacci ; quick power ; matrix for Fibonacci ; [derivation
Predatory fungi of Uzbekistan I'm going to continue serious math. But not today. Let's take a short break. Yesterday I fell in a poetic pit. Everything started with a short funny rhyme, published in a channel I read. I'm
Photo shared on October 31, 2026
Cube root in Python Quite a funny thing. It turned out that the Python works in the complex plane by default. Therefore when you are trying to take a cube root of a negative number ** operator thinks in complex plane in
Almost integers Let's look at the expression we derived in the previous post: fn=5(21+5)n−(21−5)n. Let's look at the values inside the
Derivation of a formula for the nth Fibonacci number While we are talking about different ways of calculating terms of the famous sequence, let's derive the closed-form expression for the nth number. In school I had some
Matrix multiplication for Fibonacci When you have four sections in an RC phase-shift circuit, it is quite a mundane task to write down Kirchhoff's equations and to solve them. Calculation of the complex voltage transfer
Toward fast Fibonacci. Power python def fast_pow(x, n): accum = 1 p2 = x while n: if n % 2: accum *= p2 p2 = p2 * p2 n //= 2 return accum It's fast exponentiation in Python. If you want, check it in Rust. It w
Almost efficient calculation of the Fibonacci sequence Programming interviews are insane. At Meta my friend was asked to print out the n-th number in the Fibonacci sequence. We already know how not to do it. But how do w
Shades of inefficiency The worst thing you can do when someone asks you to calculate binomial coefficients or Fibonacci numbers is to write a function that implements the definition of these objects from a schoolbook ver
Efficient calculation of nth row of Pascal's triangle Finally, let's gather all the stones we've thrown. I mentioned calculating the whole n-th row in Pascal's triangle in T=O(n), M=O(1). There was also [leetcode 62]
Calculating a row of Pascal's triangle in linear time: Part 2 It's the famous Pascal's triangle. Ones on the roof. Each element below is equal to the sum of its two upstairs neighbors. My first attempt to write a program
Calculating a row of Pascal's triangle in linear time: Part 1 Let me explain why, after telling you about the number of robot paths, I suddenly got sentimental and wrote about Evgeniy Pankrat'ev. In [Problem 62](
Precision and accuracy, bias and variance Eleven years ago, my boss at Yandex told me that reading machine learning books in Russian was a bad idea. If you did, you wouldn't know the right terms to search for online. So,
In memory of Evgeny Pankrat'ev In my school years I met a lot of bright and interesting people. Each of them was unique and definitely worth mentioning. Problem 62, which I mentioned a few days ago, brought back precious
A solar symbol on a manhole cover in Armenia. Have a nice Friday! P.S. Feel free to share something interesting or funny in the comments!
62. Unique paths There is a leetcode problem about counting unique paths on mxn grid for a robot that can move either down or right. Try to guess why this program solves this problem: (a, b) = (m - 1, n - 1) let (n,