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

Reply via email to