Talk:Factors of an integer: Difference between revisions
Content added Content deleted
(→fix bug in k ( kx.com's dialect of APL ): new section) |
|||
Line 28: | Line 28: | ||
==Python relative performance== |
==Python relative performance== |
||
Hi Ledrug, care to join us over on [[Talk:Proper_divisors#Python:_comparisons]]... --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 08:45, 20 December 2014 (UTC) |
Hi Ledrug, care to join us over on [[Talk:Proper_divisors#Python:_comparisons]]... --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 08:45, 20 December 2014 (UTC) |
||
== fix bug in k ( kx.com's dialect of APL ) == |
|||
The code <lang K> f:{d:&~x!'!1+_sqrt x;?d,_ x%|d}</lang> |
|||
was not working with current KDB version .. "~x!'" gives a type error |
|||
"q" is a literate wrapper for "k" so I provided that to make it clearer what the code is doing |
|||
<lang K>q) f:{i:{y where x=y*x div y}[x ; 1+ til floor sqrt x]; distinct i,x div reverse i}</lang> |