Closest Factor Pair Sum for 1234567890

Closest factor pair sum of number is a medium quant interview question on Brain Teasers, reported to have been seen at Optiver.

Difficulty Medium Topic Brain Teasers Reported at Optiver

MyQuantPartner is not affiliated with, endorsed by, or sponsored by these companies, and all trademarks belong to their respective owners.

This quant interview brain teaser is about finding a special factorization of a large composite integer that makes the two factors as close as possible. It pushes you to connect raw integer arithmetic with deeper number theory ideas like prime factorization, balance, and symmetry around a square root. In the context of quant prep, it sits at the intersection of puzzle solving and rigorous mathematical thinking.

It trains your ability to decompose a structure into components and allocate them optimally under a hidden objective. You practice reasoning about combinatorial partitions, understanding how multiplicative structure interacts with size, and using approximations and intuition to guide a discrete search. It also builds comfort with turning a vague notion like "closest" into a precise quantitative criterion.

This matters for quant interviews because many trading and research problems reduce to balancing or partitioning resources under constraints. Interviewers want to see that you can translate an objective into a clear mathematical target, explore the search space intelligently, and justify why a solution is optimal, not just found by luck. This style of factorization puzzle closely mirrors the logical discipline needed for real quant work.

What it tests

When splitting a composite number into two factors with minimal absolute difference, the key is to partition its prime factors into two groups whose products are as close as possible. This is fundamentally a variant of the 'partition problem' from combinatorics, where the goal is to divide a set of numbers (here, the logarithms of the prime factors) into two subsets with sums as close as possible. The intuition is that the product of numbers is closest when their logs sum to nearly equal values, since multiplying corresponds to adding logs. This principle holds because the difference $|a-b|$ is minimized when $a$ and $b$ are both near the square root of the original number, which is achieved by balancing the multiplicative weight of the factors.

Practise this question with written feedback, or hear it in a spoken mock interview.

Get started free