Skip, Here is a little simpler version of fps1. I looked at forks in LJ and 
what I am looking for is a dyadic fork. This doesn’t seem to have one either.

fps2=: 13 :'y#~0=(+/"1) 2|_ q:y'
   
   (fps 2+i.1000)-:fps2 2+i.1000
1
   fps2
  ┌─ ]                       
  ├─ ~ ─── #                 
  │                          
──┤     ┌─ 0                 
  │     ├─ =                 
  │     │   ┌─ [:            
  └─────┤   │     ┌─ / ─── + 
        │   ├─ " ─┴─ 1       
        └───┤                
            │     ┌─ 2       
            │     ├─ |       
            └─────┤     ┌─ _ 
                  └─────┼─ q:
                        └─ ] 
   
Linda

-----Original Message-----
From: Programming <[email protected]> On Behalf Of Linda 
Alvord
Sent: Saturday, November 3, 2018 10:03 PM
To: [email protected]
Subject: Re: [Jprogramming] Square Roots and Extended Arithmetic

Skip, I can't find the fork in fps1

(fps 2+i.1000)-:fps1 2+i.1000
1
   
   fps1
  ┌─ ]                           
  ├─ ~ ─── #                     
  │                              
──┤     ┌─ 0                     
  │     ├─ =                     
  │     │   ┌─ [:                
  └─────┤   │     ┌─ / ─── +     
        │   ├─ " ─┴─ 1           
        └───┤                    
            │     ┌─ [:          
            │     ├─ ]           
            └─────┤     ┌─ 2     
                  │     ├─ |     
                  └─────┤   ┌─ _ 
                        └───┼─ q:
                            └─ ] 
   fps
  ┌─ ]            
  ├─ ~ ─── #      
  │               
──┤     ┌─ [:     
  │     │    ┌─ = 
  └─────┼────┴─ >.
        └─ %:     
   

Linda


-----Original Message-----
From:S Programming <[email protected]> On Behalf Of Skip 
Cave
Sent: Saturday, November 3, 2018 10:43 AM
To: [email protected]
Subject: Re: [Jprogramming] Square Roots and Extended Arithmetic

Also, there's a completely different way to attack the problem of finding 
perfect squares using the dyadic form of q: (Prime Exponents). I discovered 
this while reading NuVoc about q:

fps1 =: 13 :'y#~0=+/"1]2|_ q:y'


fps1 2+i.100

4 9 16 25 36 49 64 81 100


fps1 8200+i.1000

8281 8464 8649 8836 9025


%: 8281 8464 8649 8836 9025

91 92 93 94 95


fps1

] #~ 0 = [: +/"1 [: ] 2 | _ q: ]


The secret is: if all exponents of the prime factors of an integer are even, 
the number is a perfect square.


Skip


Skip Cave
Cave Consulting LLC
----------------------------------------------------------------------
For information about J forums see 
https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&amp;data=02%7C01%7C%7C6e9f540deff6465f962f08d641f9af42%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636768937966605630&amp;sdata=0byKD4NRbwlIJ40aleddiF2ggzI2PsNZwGU9vmmIQ58%3D&amp;reserved=0
----------------------------------------------------------------------
For information about J forums see 
https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&amp;data=02%7C01%7C%7C6e9f540deff6465f962f08d641f9af42%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636768937966605630&amp;sdata=0byKD4NRbwlIJ40aleddiF2ggzI2PsNZwGU9vmmIQ58%3D&amp;reserved=0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to