### by Colin Vout

#### Published Sunday June 19 2022 (link)

A square, a triangle and a circle went into a bar. The barman said, “Are you numbers over 18?” They replied, “Yes, but we’re under a million.” The square boasted, “I’m interesting, because I’m the square of a certain integer.” The triangle said, “I’m more interesting; I’m a triangular number, the sum of all the integers up to that same integer.” The circle said, “I’m most interesting; I’m the sum of you other two.” “Well, are you actually a circular number?” “Certainly, in base 1501, because there my square ends in my number exactly. Now, shall we get the drinks in?” The square considered a while, and said, “All right, then. You(’)r(e) round!”

In base 10, what is the circular number?

From → Uncategorized

1. • @Brian, your alternative program doesn’t print a solution.

C being less than 1501 seems a bit strange as all three numbers are reported to be under a million.

• @Frits

Thanks, I have corrected the alternative version now.

Yes, its a bit surprising that the solution is so low compared to the
range given in the teaser. But the teasers are intended for manual
solution so including a clue that C is less than 1501 makes sense
in my view.

• Easier for me to understand (modular square roots):

(C^2 – C) % 1501 = 0
(4C^2 – 4C) % 1501 = 0
(4C^2 – 4C + 1) % 1501 = 1
(2C – 1)^2 % 1501 = 1

• Modular square roots are tricky to compute in general but the mod
value in this case has been chosen to make this easy since 1501 is
the product of two primes – 19 and 79 .

The extended GCD algorithm can be used to express any number as a
linear combination of multiples of 19 and 79. Finding the square
roots of 1 mod 19 and 79 is easy enough to do manually, after which
the Chinese Remainder Theorem can be used to combine them to find
square roots of 1 mod 1501.

2. 