RE Boss wrote:
>  http://www.jsoftware.com/jwiki/Essays/Collatz_Conjecture

Ah, thanks for this pointer.  I remember the sequence being called "the 
wondrous numbers" in Godel Escher Bach, but I don't think I've ever encountered 
this name.

I wrote:
> I'm not satisfied with my solution to "cast out all factors of two".
> A secondary nit to pick:  I don't like the way I pick "n > 0 and odd"

The Essay's verb kills two verbs with one stone, by treating "triple and 
increment" and "cast out a (single) power of two" as separate intermediate 
steps.  

That is, if  N  is even, it's halved (casting out a single power of two).  
Otherwise (if  N  is odd) it's tripled and incremented.  Either way, the verb 
is then applied to its output (so if N were a power of 2, the 
triple-and-increment would never be invoked).

Whereas my verb implements the sentence:

   Pick n > 0 and odd, multiply by three,
   add one, cast out all factors of two, 
   cook 'til (d)one.

atomically.  If  N  is even, it's incremented, then it's tripled and 
incremented, then all powers of 2 are cast out (simultaneously), then verb is 
applied to its output (so even if  N  were a power of 2, the 
triple-and-increment would still be applied).

So the two verbs, given the same input, can produce different output sequences. 
 In general, the sequences produced by casting-out all powers simultaneously 
will be shorter than those produced by casting-out one power at a time.  An 
obvious exception is when the input is a power of 2 (see above).

I believe the difference in formulation is due to the different English 
descriptions of the problem from which the verbs were transliterated.  I'm 
still interested in verbs which can cast-out all factors of a number (narrowly: 
a prime number; broadly: any integer) simultaneously.

-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to