#1
  1. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2004
    Location
    Middle Europa
    Posts
    1,198
    Rep Power
    17

    *nix 'dc' guru needed


    hello
    googling, i found this 'wurst' (german for sausage)
    Code:
      2p3p[dl!d2+s!%0=@l!l^!<#]s#[s/0ds^]s@[p]s&[ddvs^3s!l#x0<&2+l.x]ds.x
    it's a reverse polish formula to print PRIMES using *nix /bin/dc

    so the cmd: (use bourn-sh, or mask metas)
    echo "$sausage" | dc
    will very fast AND endless print primes on stdout.

    i'm quite familiar to '[bd]c' and 'reverse-polish'
    but i cannot (in the exemple above) figure out, how to say:

    start at X and stop at Y (sure X and Y are integers, 1+X > 0 && X < Y)

    thanks for help
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2004
    Location
    Middle Europa
    Posts
    1,198
    Rep Power
    17
    no 'dc' prof around ?

IMN logo majestic logo threadwatch logo seochat tools logo