Re: [dev] [sbase][PATCH] Add factor(1)

From: Marc Collin <marc.collin7_AT_gmail.com>
Date: Thu, 25 Feb 2016 19:26:52 -0300

#include <stdio.h>
int main(void)
{
   int i = 2;
   long n = 600851475143;
   for (; n > 1; i++)
     for (; n % i == 0; n /= i)
       printf("%d\n", i);
   return 0;
}


On Thu, Feb 25, 2016 at 7:15 PM, FRIGN <dev_AT_frign.de> wrote:
> On Thu, 25 Feb 2016 23:03:14 +0100
> Mattias Andrée <maandree_AT_kth.se> wrote:
>
> Hey Mattias,
>
>> I haven't spent too much time on it. But why don't we
>> need factor, it is in coreutils and is useful to have?
>
> why not just write a naive implementation, using no external libs.
> I'm sure you can write a prime factorizer in under 30 lines of code.
>
> Cheers
>
> FRIGN
>
> --
> FRIGN <dev_AT_frign.de>
>
Received on Thu Feb 25 2016 - 23:26:52 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 25 2016 - 23:36:10 CET