However:

   __ q: 403291461126567024928620025
 2 3 11 439 405098581807
36 1  1   1            1
   __ q: 403291461126567024928620025x
|nonce error
|   __     q:403291461126567024928620025
   <.@%: 403291461126567024928620025x
20082117944245

Sometimes it pays to take the brute force route.

Thanks,

-- 
Raul

On Sun, May 17, 2020 at 10:00 PM 'Pascal Jasmin' via Programming
<[email protected]> wrote:
>
>  q: 729
> 3 3 3 3 3 3
>
>
>
> __ q: 729
>
> 3
> 6
>
> a perfect square will have __&q: return even numbers for the 2nd row.
>
>
>
> On Sunday, May 17, 2020, 09:32:04 p.m. EDT, Hauke Rehr 
> <[email protected]> wrote:
>
>
>
>
>
> First, Skip already mentioned that. His posts are about J’s behaviour.
> Second, your reasoning is flawed.
> */ 3 ^ i.4 includes non-square factors and is a perfect square.
> Think about prime numbers and their distribution,
> and you’ll get a valid answer.
>
> Am 18.05.20 um 03:22 schrieb 'Pascal Jasmin' via Programming:
> > Searching for perfect squares is best done by squaring the next integer.  
> > The first 1000 perfect squares are *: >: i.1000  No factorial number is a 
> > perfect square because it includes a non-square factors.
> >
> >
> >
> >
> >
> >
> > On Sunday, May 17, 2020, 09:08:15 p.m. EDT, Skip Cave 
> > <[email protected]> wrote:
> >
> >
> >
> >
> >
> > Roger,
> >
> > I don't understand your last post.  I'm trying to find a way to search for
> > perfect squares.
> >
> > For smaller integers the plan is easy.
> > 1. Generate a list of integers (eg. 1 to 30):
> >    ]n=.>:i.30
> >
> > 2. Take the square root of each one (%:)
> >      %:n
> >
> > 1 1.4142 1.7321 2 2.2361 2.4495 2.6458 2.8284 3 3.1623 3.3166 3.4641 3.6056
> > 3.7417 3.873 4 4.1231 4.2426 4.3589 4.4721 4.5826 4.6904 4.7958 4.899 5
> > 5.099 5.1962 5.2915 5.3852 5.4772
> >
> >
> > 3. Find and mark the square roots of n that are integers (=>.)
> >
> > (=>.)%:n
> >
> > 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0
> >
> >
> > 4. Use the marks to select the integers in n that are perfect squares (n#~):
> >
> > n#~(=>.)%:n
> >
> > 1 4 9 16 25
> >
> >
> > So we are able to find the perfect squares in the range 1 to 30.
> >
> >
> > Now I want to find the perfect squares in the range of factorial 1 to 30:
> >
> > Actually I know that factorials of integers *can't* have square roots
> > (except !1), but I want to check. See https://bit.ly/3fXevkr
> >
> >
> > So we generate the factorials of the integers 1 to 30 and store them in n:
> >
> > ]n=.!>:i.30x
> >
> > 1 2 6 24 120 720 5040 40320 362880 3628800 39916800 479001600 6227020800
> > 87178291200 1307674368000 20922789888000 355687428096000 6402373705728000
> > 121645100408832000 2432902008176640000 51090942171709440000
> > 1124000727777607680000 25852016738884976640000 620448401733239439360000
> > 15511210043330985984000000 403291461126605635584000000
> > 10888869450418352160768000000 304888344611713860501504000000
> > 8841761993739701954543616000000 265252859812191058636308480000000
> >
> >
> > Now take the square roots of those 30 factorials, then find & mark any of
> > the square roots that are integers. We know that only the first square root
> > (%:!1) should be an integer, since 1 is a perfect square. all the square
> > roots of the other factorials should not be integers, as they are not
> > perfect squares.
> >
> >
> > (=>.)%:n
> >
> > 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1
> >
> > Uh oh! J is telling me that factorials of the last 5 integers (n=.26 27 28
> > 29 30) are perfect squares! This is clearly not true. Roger showed this in
> > his response to me, but he didn't propose a solution.
> >
> >
> > How can I take the square root of large integers such as !26 27 28 29 30 in
> > J, and get an accurate floating point or rational number?
> >
> >
> > Skip Cave
> >
> >
> >
> > On Sun, May 17, 2020 at 4:18 PM Roger Hui <[email protected]> wrote:
> >
> >> Use <.@%:
> >>
> >>      s=: <.@%: !26x
> >>      s
> >> 20082117944245
> >>      s*s
> >> 403291461126567024928620025
> >>      !26x
> >> 403291461126605635584000000
> >>
> >>
> >> On Sun, May 17, 2020 at 2:00 PM Skip Cave <[email protected]> wrote:
> >>
> >>> We can find perfect squares in a list by taking the square root (%:) of a
> >>> number, and checking to see if it is an integer:
> >>>
> >>> * n#~(=>.)%:n=.>:i.30*
> >>>
> >>> *1 4 9 16 25*
> >>>
> >>>
> >>> Now we can try larger integers by taking the square root of the factorial
> >>> of some small integers:
> >>>
> >>> * n#~(=>.)%:!n=.>:i.30*
> >>>
> >>> *1 26 27 28 29 30*
> >>>
> >>>
> >>> Hmm. This says that !26 and up, are perfect squares.
> >>>
> >>> * !26x*
> >>>
> >>> *403291461126605635584000000*
> >>>
> >>> * %:!26x*
> >>>
> >>> *20082117944246*
> >>>
> >>>
> >>> Well it looks like %:!26x is an integer, making !26x a perfect square.
> >>> Let's check:
> >>>
> >>> * 20082117944246x^2*
> >>>
> >>> *403291461126607189164508516*
> >>>
> >>> * !26x*
> >>>
> >>> *403291461126605635584000000*
> >>>
> >>>
> >>>    *  (!26x)-:20082117944246x^2 *
> >>> *0*
> >>> Clearly, !26x is not a perfect square.
> >>>
> >>> Looks like J has precision issues with the square root of large extended
> >>> integers. How can I fix this, to find accurate square roots of large
> >>> integers?
> >>>
> >>> Skip Cave
> >>> ----------------------------------------------------------------------
> >>> 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
> >
>
> --
> ----------------------
> mail written using NEO
> neo-layout.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

Reply via email to