As usual you have a way of coming up with something brilliant that takes
some time for me to understand.

I get it with the perfect squares and perfect cubes because that is what I
was originally after but what has the perfect 6-th power to do with this?

And by the way g3a gives me 86 and not 87

   f3 =: - -/@:>.@:(2 6 3&%:)
   f3 87
75
   g3a=: + -/@:>.@:(2 6 3&%:)
   g3a 75
86



2010/12/27 Roger Hui <rhui...@shaw.ca>

> A fast inverse for f derives by observing that f is
> equivalent to:
>
> f3 =: - -/@:>.@:(2 6 3&%:)
>
> That is, f3 n is n less the perfect squares and
> perfect cubes bounded by n, plus the perfect 6-th
> powers.  The function g3a then is very near to the
> inverse to f3 :
>
> g3a=: + -/@:>.@:(2 6 3&%:)
>
> For example:
>
>   f3 1e9
> 999967409
>   g3a 999967409
> 1000000000
>
> However:
>   g3a 112
> 125
>   f3 125
> 111
>
> The details of deriving g3, the inverse for f3, are left
> as an exercise for the reader.
>
>
>
> ----- Original Message -----
> From: Björn Helgason <gos...@gmail.com>
> Date: Sunday, December 26, 2010 11:48
> Subject: [Jprogramming] finding number
> To: Programming forum <programming@jsoftware.com>
>
> > 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
> > answerbeing 87)
> >
> > Could be asking what argument y do I need to find x numbers
> > according to the
> > formula above
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
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

Reply via email to