Package: num-utils
Version: 0.5-3
Severity: wishlist
File: /usr/bin/numgrep


For example, this is pretty slow, it takes a few minutes
on my 800mhz PIII:

    % seq 1 1000001 | numgrep /f777777/

I notice it still checks even after the top factor is reached:

    # ts: timestamp standard input  (from 'moreutils' package)
    % { seq 1 100000 | numgrep /f7/ ; echo end ; } | ts
    14:43:41 1
    14:43:41 7
    14:43:56 end

...in a way, that's 15 seconds wasted.

Possible speedups...

Let 'F' = the factor.  Sort a copy of list, and use in a dimensional array,
e.g.:

    % echo "3
    5
    1
    "

...our linked list array would look like:

    N           list(N)         sort(N)         flag(N)
    1           3               1               true
    2           5               3               true
    3           1               5               true

...then set the flag, linked to both 'sort(N)' and 'list(N)' according
to various tests.  Apologies for not describing more completely how the
linked list should work.  This is only a sketch.

Get prime factors using 'factor F' (in 'coreutils) and use those to
reduce the set.  Don't search for numbers higher than 'F'.  Stuff like
that.

PS: 'numgrep' is a handy utility!


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.16-2-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)

Versions of packages num-utils depends on:
ii  perl                          5.8.8-6    Larry Wall's Practical Extraction 

num-utils recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to