Sunday, October 13, 2019

Collatz Conjecture

I've previously linked to Jason Davies website for another article. He has another JavaScript program for the Collatz Conjecture.

To pretty it up, remove the circle fill in collatz.css and modify the circle append (line 83) in collatz.js as follows:
      nodeEnter.append("circle")
          .attr("fill", function(d) {
            var cc;
            var i = parseInt(d.data);
            if ((i && (i & (i - 1)) === 0) && (i <= 16)) {
              cc = "#0000ff";
            }
            else if ((i % 3) === 0) {
              cc = "#c8c8c8";
            }
            else if ((i % 6) === 1) {
              cc = "#ffff00";
            }
            else if (((i % 2) === 1) || (((i % 3) === 2) && (((i / 2) % 2) === 0))) {
              cc = "#ffa500";
            }
            else {
              cc = "#000000";
            }
            return cc;
          })
         .attr("r", 5);
I was only interested in the initial node for those in orange and yellow.

Thursday, October 10, 2019

Minimal Set for Powers of 2

The minimal set for powers of 2 is currently nondeterministic and can be shown to be more complex than previously proposed.

Click here for my analysis on it.