Hacker News new | past | comments | ask | show | jobs | submit login

"What you're looking at, then, is taking the operation defined by c (rotate by -arg(c) and dilate by 1/|c|) and asking, if you take the Gaussian integers as the vertexes of a directed graph, what fraction of the vertexes are the source of an edge."

This doesn't sound like a mathematical operation. Can you give a more mathematical definition of the full graph? For Gaussian integers a+ib, c+id, (a+ib, c+id) is a directed edge from a+ib to c+id if and only if what?

Whatever this directed graph (V, E) is, where V = Z + iZ and E \subseteq V \times V, it is not clear how the complex number c relates to the proportion of z in V such that there exists w in V with (z, w) in E. We have to know what E is before we can answer this.

OK, for a less abstract description, the site gives:

"For each complex number c calculate the following: For all gaussian integers g like 1+1i, 2+2i, 3+3i... when calculating g/c which percentage results in a gaussian integer again? The higher the percentage, the lighter the pixel."

So, Imagine you have:

   c = a+bi
   g = x+xi
Division by complex numbers is simplified with a trick of multiplying both numerator and divisor by the complex conjugate of the divisor, so we compute:-

  1 / c = c' / ( c * c' )
And we know that c * c' will always be real rather than complex.

  1 / c = (a-bi) / (a^2 + b^2)
Now it's just a case of iterating through the possibilities of g and seeing if g time this value of 1/c produces a gaussian integer again.

  x+xi * a-bi = ( x*a - x*b*i^2 ) + i*(x*a - x*b)

  = x ( a+b + i(a-b) )

  g/c = x [ a+b + i(a-b) ) / (a^2 + b^2) ]             where g = x+xi
So for any g = x+xi this will only be a gaussian integer if both:-

  (a^2 + b^2) | x*(a+b)
  (a^2 + b^2) | x*(a-b)
And the original algorithm is testing all gaussian integers where 0 <= x <= 100

(Probably riddled with mistakes, should really be revising for my final Maths exam tomorrow morning...)

jc-denton replied, but appears to be hellbanned. His reply looks like this: ---

Humm tried to implement it simply using std::complex but it does not give me meaningful results. What did I do wrong?

template<class T> void CalcRealPercentage( const complex<T> from, const complex<T> to, const int intervalSize, std::vector<int>& intensityMap ){ auto height = to.imag() - from.imag(); auto width = to.real() - from.real();

    assert(intervalSize > 0 && height > 0 && width > 0 && from > 0);
    intensityMap.resize(width * height, 0);
    for (complex<T> c = from; c.imag() < to.imag(); c.imag(c.imag() + 1)) {
        for (; c.real() < to.real(); c.real(c.real() + 1)) {
            for (auto i = 0; i < intervalSize; i++) {
                complex<T> g(i, i);
                complex<T> result = g / c;
                auto imagPart = result.imag();
                if (imagPart == 0) {
                    intensityMap.at(c.imag() * width + c.real())++;

Seems to be after this comment: https://news.ycombinator.com/item?id=3468011

Not sure why he was hellbanned and not Zed after that little exchange.

Because readers of hacker news, as objective and spock-like as they like to think they are, really can't help but reverse-ad hominen when they vote. People are right because of who they are, not what they said. At the very least the bias appears as a benefit of the doubt.

PG should have, instead of removing vote totals, removed usernames. But of course that would get in the way of the ego stroking..

(I am of course no exception)

Applications are open for YC Winter 2022

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact