[ Back to the overview Matrix ]

Test case : Prime Numbers using APL

Lines used: 7
    [1]   START:{->}(HOWMANY>{shape}{/\}PRIMES)/MORE
    [2]    R{<-}HOWMANY{take}{/\}PRIMES
    [3]    {->}0
    [4]   MORE: MAX{<-}({-}1{take}{/\}PRIMES)-{iota}100
    [5]   LOOP: {->}({or}/0={/\}PRIMES|MAX{<-}MAX+100)/LOOP
    [6]    {/\}PRIMES{<-}{/\}PRIMES,MAX
    [7]    {->}START
Contributed by Arthur J. O'Dwyer, ajo at nospam.andrew.cmu.edu