A bit more elegant solution: g2=:((>:@:])^:([>f@:])^:_)~
A do while loop. The trick here is that the ~ adverb allows me to use two arguments (x) and (y) when I only supply (y). The (x) can be used as a reference and I just increment and test until f(x) > y ts 'g2 6037' 0.106917 371328 g=: i.~ f"0@:i.@:+: ts 'g 6037' 12.5618 869376 Cheers, bob On 2010-12-26, at 3:38 PM, bob therriault wrote: > Whoops, too much turkey!! > > I meant to say that: > g=: i.~ f"0@:i.@:+: > g 75 > 87 > > Cheers, bob > > On 2010-12-26, at 1:48 PM, bob therriault wrote: > >> Hi Björn, >> >> This is a bit brute force but it seems to work. >> g=: i.~ f"0@:i.@:+: >> g 87 >> 75 >> >> Essentially applying f to a list up to twice the argument (y) and returning >> the index (x) of the first spot f(x)=y >> >> Cheers, bob >> >> ps. I believe your original f can also be written as: >> f1=: [: # i. -./ 2 3 ^~ i. >> >> On 2010-12-26, at 11:47 AM, Björn Helgason wrote: >> >>> I have a small task that looks like this >>> >>> f=: [: # i. -. (2 ^~ i.) , 3 ^~ i. >>> f 87 >>> 75 >>> >>> I want to use tacit to find what number gives me 75 numbers (the answer >>> being 87) >>> >>> Could be asking what argument y do I need to find x numbers according to the >>> formula above >>> >>> -- >>> Björn Helgason, Verkfræðingur >>> Fornustekkum II >>> 781 Hornafirði, >>> t-póst: gos...@gmail.com >>> gsm: +3546985532 >>> sími: +3544781286 >>> http://groups.google.com/group/J-Programming >>> >>> >>> Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans >>> >>> góður kennari getur stigið á tær án þess að glansinn fari af skónum >>> /|_ .-----------------------------------. >>> ,' .\ / | Með léttri lund verður | >>> ,--' _,' | Dagurinn í dag | >>> / / | Enn betri en gærdagurinn | >>> ( -. | `-----------------------------------' >>> | ) | (\_ _/) >>> (`-. '--.) (='.'=) ♖♘♗♕♔♙ >>> `. )----' (")_(") ☃☠ >>> ---------------------------------------------------------------------- >>> 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm