I found the "insert" to be slightly confusing when simple use of "power" works as well: (+:@<:)^:_7 ] 2 NB. x=# bridges, y=# cakes for Granny
Though this did make me wonder about negative powers, so I was amused by this: +:^:_7]2 On Mon, Jun 9, 2014 at 2:33 PM, Dan Bron <[email protected]> wrote: > The negative in my algorithm was to indicate "working backwards". > > That is, if I want to end up with 2 cakes after bridge 7, during which you > gained 1 and lost x/2, what must x be? Given that, what must you have had > before bridge 6? And so on. > > In other words, that expression was intended to be the J transliteration > of "If you 'undo' 1+x%2 seven times, what do you start out with?". > > -Dan > > Please excuse typos; sent from a phone. > > > On Jun 9, 2014, at 2:25 PM, Raul Miller <[email protected]> wrote: > > > > For what it's worth, my algorithm came up with the same answer as Dan's > for > > the 7 bridge 2 cake case, but comes up with a different answer for the 1 > > bridge 3 case case: > > +:@<:^:7: 2 > > > > +:@<:^:1: 3 > > > > -- > > Raul > > > > > > > > > >> On Mon, Jun 9, 2014 at 2:06 PM, greg heil <[email protected]> wrote: > >> > >> Dan > >> > >>> Rounding amongst Trolls is pretty peculiar;) Say you wanted to give > >> Granny 3 cakes and only had to cross one bridge ... Your algorithm says > >> you only need start with 2.5 cakes! (Kinda unhygienic on the offspring's > >> part;-) > >> > >> greg > >> ~krsnadas.org > >> ---------------------------------------------------------------------- > >> For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Devon McCormick, CFA ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
