Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #20536 > unrolled thread

project euler problems in forth

Started bybob wilkinson <wilkinson.bob@gmail.com>
First post2013-03-11 03:25 -0700
Last post2013-07-06 05:53 +0000
Articles 20 on this page of 35 — 8 participants

Back to article view | Back to comp.lang.forth


Contents

  project euler problems in forth bob wilkinson <wilkinson.bob@gmail.com> - 2013-03-11 03:25 -0700
    Re: project euler problems in forth m.a.m.hendrix@tue.nl - 2013-03-11 04:32 -0700
    Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-03-11 11:31 +0000
      Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-06-14 15:50 +0000
    Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-03-11 12:13 +0000
      Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-03-11 12:26 +0000
        Re: project euler problems in forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-11 10:13 -0500
          Re: project euler problems in forth Doug Hoffman <glidedog@gmail.com> - 2013-03-11 11:34 -0400
            Re: project euler problems in forth The Beez <the.beez.speaks@gmail.com> - 2013-03-11 14:43 -0700
              Re: project euler problems in forth Doug Hoffman <glidedog@gmail.com> - 2013-03-12 04:50 -0400
    Re: project euler problems in forth Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2013-03-11 12:46 +0000
      Re: project euler problems in forth Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2013-03-11 12:56 +0000
    Re: project euler problems in forth albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-11 12:43 +0000
    Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-03-11 12:49 +0000
      Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-03-11 19:44 +0000
    Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-03-11 13:54 +0000
    Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-03-11 20:04 +0000
      Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-07-06 05:31 +0000
    Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-03-11 20:19 +0000
    Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-03-11 20:44 +0000
    Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-03-11 23:00 +0000
      Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-07-06 05:47 +0000
    Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-03-12 00:15 +0000
    Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-03-12 00:46 +0000
    Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-03-12 01:06 +0000
      Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-07-06 06:13 +0000
    Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-03-12 02:29 +0000
      Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-06-18 10:44 +0000
      Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-07-06 05:51 +0000
    Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-03-12 03:09 +0000
      Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-06-18 16:16 +0000
        Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-06-18 16:21 +0000
    Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-03-12 09:45 +0000
      Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-06-18 11:51 +0000
      Re: project euler problems in forth "WJ" <w_a_x_man@yahoo.com> - 2013-07-06 05:53 +0000

Page 1 of 2  [1] 2  Next page →


#20536 — project euler problems in forth

Frombob wilkinson <wilkinson.bob@gmail.com>
Date2013-03-11 03:25 -0700
Subjectproject euler problems in forth
Message-ID<2f19628a-24d6-4480-85af-f081e9208643@googlegroups.com>
After I killed my fignition with static (I think), I decided that before I considered buying another that I should brush up my forth programming skills. It had been a *lot* of years since I had used forth. As a learning exercise, I wrote the first 25 problems from http://projecteuler.net/. 

My code is at http://www.fourtheye.org/cgi-bin/language.pl?language=forth. Some timing data and comparison with other languages is at http://www.fourtheye.org/projecteulertable.html. I used gforth and gforth-fast for timing.

[toc] | [next] | [standalone]


#20538

Fromm.a.m.hendrix@tue.nl
Date2013-03-11 04:32 -0700
Message-ID<dcd2470d-0952-493c-8975-5bda905eeaeb@googlegroups.com>
In reply to#20536
On Monday, March 11, 2013 11:25:25 AM UTC+1, bob wilkinson wrote:
> After I killed my fignition with static (I think), 

I knew static typing hurts, but that it is that dangerous...

[..]
> Some timing data and comparison with other languages is at 
> http://www.fourtheye.org/projecteulertable.html. I used 
> gforth and gforth-fast for timing.

Did you write a solution for these problems in all the languages shown? If not, comparing timings is not meaningful. Even if you wrote them yourself, it is unknown to what level you master these languages and again, unwarranted conclusions might be drawn.

Please add your results to the Euler pages, we can use a boost in ratings.
(Many people only doing a few problems works out negative for Forth's public image, we need a few [more] maniacs).

-marcel

[toc] | [prev] | [next] | [standalone]


#20539

From"WJ" <w_a_x_man@yahoo.com>
Date2013-03-11 11:31 +0000
Message-ID<khkfak$fj9$1@dont-email.me>
In reply to#20536
bob wilkinson wrote:

> After I killed my fignition with static (I think), I decided that
> before I considered buying another that I should brush up my forth
> programming skills. It had been a lot of years since I had used
> forth. As a learning exercise, I wrote the first 25 problems from
> http://projecteuler.net/.
> 
> My code is at
> http://www.fourtheye.org/cgi-bin/language.pl?language=forth. Some
> timing data and comparison with other languages is at
> http://www.fourtheye.org/projecteulertable.html. I used gforth and
> gforth-fast for timing.

I broke your lines for you.  When you post to usenet, you must
limit the length of your lines.

Problem 1.

Find the sum of all the multiples of 3 or 5 below 1000.

Factor:

USING: locals math.ranges math.functions ;

:: any-divisors? ( n seq -- n/0 )
  seq [| m |  n m divisor? ] any?  n 0 ? ;

:: sum-multiples ( ceiling seq -- n )
  ceiling [1,b) [ seq any-divisors? ] map-sum ;

1000 { 3 5 } sum-multiples .
233168

[toc] | [prev] | [next] | [standalone]


#23604

From"WJ" <w_a_x_man@yahoo.com>
Date2013-06-14 15:50 +0000
Message-ID<kpfe4i$jee$1@dont-email.me>
In reply to#20539
WJ wrote:

> bob wilkinson wrote:
> 
> > After I killed my fignition with static (I think), I decided that
> > before I considered buying another that I should brush up my forth
> > programming skills. It had been a lot of years since I had used
> > forth. As a learning exercise, I wrote the first 25 problems from
> > http://projecteuler.net/.
> > 
> > My code is at
> > http://www.fourtheye.org/cgi-bin/language.pl?language=forth. Some
> > timing data and comparison with other languages is at
> > http://www.fourtheye.org/projecteulertable.html. I used gforth and
> > gforth-fast for timing.
> 
> I broke your lines for you.  When you post to usenet, you must
> limit the length of your lines.
> 
> Problem 1.
> 
> Find the sum of all the multiples of 3 or 5 below 1000.
> 
> Factor:
> 
> USING: locals math.ranges math.functions ;
> 
> :: any-divisors? ( n seq -- n/0 )
>   seq [| m |  n m divisor? ] any?  n 0 ? ;
> 
> :: sum-multiples ( ceiling seq -- n )
>   ceiling [1,b) [ seq any-divisors? ] map-sum ;
> 
> 1000 { 3 5 } sum-multiples .
> 233168

Ruby:

(1...1000).reduce(0){|sum,n|
  sum + ((n.modulo(3)==0) || (n.modulo(5)==0) ? n : 0)}
    ==>233168

[toc] | [prev] | [next] | [standalone]


#20540

From"WJ" <w_a_x_man@yahoo.com>
Date2013-03-11 12:13 +0000
Message-ID<khkhp5$rj1$1@dont-email.me>
In reply to#20536
Problem 2.

By considering the terms in the Fibonacci sequence whose values do
not exceed four million, find the sum of the even-valued terms.

USING: locals ;

:: fib-sum ( sum m n -- sum )
  n 4,000,000 >
  [ sum ]
  [ n even?  [ sum n + ] [ sum ] if
    n  m n +  fib-sum ]
  if ;

: prob2 ( -- n )
  0 1 1 fib-sum ;

prob2 .
4613732

[toc] | [prev] | [next] | [standalone]


#20541

From"WJ" <w_a_x_man@yahoo.com>
Date2013-03-11 12:26 +0000
Message-ID<khkigv$vcm$1@dont-email.me>
In reply to#20540
Problem 3.

What is the largest prime factor of the number 600851475143 ?

Factor:

USING: math.primes.factors ;

600851475143 factors last .
6857

[toc] | [prev] | [next] | [standalone]


#20547

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2013-03-11 10:13 -0500
Message-ID<-5-dnT0G0_EzaaDMnZ2dnUVZ_qydnZ2d@supernews.com>
In reply to#20541
WJ <w_a_x_man@yahoo.com> wrote:
> Problem 3.
> 
> What is the largest prime factor of the number 600851475143 ?
> 
> Factor:
> 
> USING: math.primes.factors ;
> 
> 600851475143 factors last .
> 6857

You're supposed to write a solution, not just use someone else's.
Why are you posting all this crap anyway?

Andrew.

[toc] | [prev] | [next] | [standalone]


#20548

FromDoug Hoffman <glidedog@gmail.com>
Date2013-03-11 11:34 -0400
Message-ID<513df979$0$32114$14726298@news.sunsite.dk>
In reply to#20547
On 3/11/13 11:13 AM, Andrew Haley wrote:
> WJ <w_a_x_man@yahoo.com> wrote:
>> Problem 3.
>>
>> What is the largest prime factor of the number 600851475143 ?
>>
>> Factor:
>>
>> USING: math.primes.factors ;
>>
>> 600851475143 factors last .
>> 6857
>
> You're supposed to write a solution, not just use someone else's.
> Why are you posting all this crap anyway?

He has stated before that he thinks Forth is only suitable for 
controlling simple mechanical devices.

He apparently has an uncontrollable compulsion to "show" readers of 
c.l.f that Ruby, Factor, and other languages are superior to Forth for 
writing programs.

I've decided to stop feeding the troll.

-Doug

[toc] | [prev] | [next] | [standalone]


#20565

FromThe Beez <the.beez.speaks@gmail.com>
Date2013-03-11 14:43 -0700
Message-ID<01f2d952-33ae-4469-baa3-7f714b78a38d@he10g2000vbb.googlegroups.com>
In reply to#20548
On Mar 11, 4:34 pm, Doug Hoffman <glide...@gmail.com> wrote:
> I've decided to stop feeding the troll.
I suppose in Google groups we could flag it as "spam" - which in fact
it is, just like cheap Nike's, fake Rolex'es, easy University grades
and pictures of modestly dressed Ukranian women.

Hans Bezemer

[toc] | [prev] | [next] | [standalone]


#20585

FromDoug Hoffman <glidedog@gmail.com>
Date2013-03-12 04:50 -0400
Message-ID<513eec40$0$32104$14726298@news.sunsite.dk>
In reply to#20565
On 3/11/13 5:43 PM, The Beez wrote:

> I suppose in Google groups we could flag it as "spam" - which in fact
> it is, just like cheap Nike's, fake Rolex'es, easy University grades
> and pictures of modestly dressed Ukranian women.

Yes.  Or activate a blocking filter if available.

-Doug

[toc] | [prev] | [next] | [standalone]


#20542

FromZbiggy <zbigniew2011REMOVE@gmail.REMOVE.com>
Date2013-03-11 12:46 +0000
Message-ID<slrnkjrnn8.cmp.zbigniew2011REMOVE@Tichy.myhome.org>
In reply to#20536
Find the sum of all the multiples of 3 or 5 below 1000.

: seu 0 1000 1 do i dup dup 3 mod swap 5 mod * 0= if + else drop then loop . ;

seu 233168  ok

-- 
The consensus was, as usual in this community, that there is no consensus. (RA)

[toc] | [prev] | [next] | [standalone]


#20544

FromZbiggy <zbigniew2011REMOVE@gmail.REMOVE.com>
Date2013-03-11 12:56 +0000
Message-ID<slrnkjroan.e94.zbigniew2011REMOVE@Tichy.myhome.org>
In reply to#20542
In comp.lang.forth, Zbiggy wrote:

> Find the sum of all the multiples of 3 or 5 below 1000.
>
>: seu 0 1000 1 do i dup dup 3 mod swap 5 mod * 0= if + else drop then loop . ;
>
> seu 233168  ok

Uh, I forgot - might be somewhat faster (no IFs):

: seu2   0 1000 1 do  i dup dup 3 mod swap 5 mod * 0= * +  loop abs . ;

seu2 233168  ok

-- 
The consensus was, as usual in this community, that there is no consensus. (RA)

[toc] | [prev] | [next] | [standalone]


#20543

Fromalbert@spenarnc.xs4all.nl (Albert van der Horst)
Date2013-03-11 12:43 +0000
Message-ID<513dd17e$0$607$e4fe514c@dreader34.news.xs4all.nl>
In reply to#20536
In article <2f19628a-24d6-4480-85af-f081e9208643@googlegroups.com>,
bob wilkinson  <wilkinson.bob@gmail.com> wrote:
>After I killed my fignition with static (I think), I decided that before
>I considered buying another that I should brush up my forth programming
>skills. It had been a *lot* of years since I had used forth. As a
>learning exercise, I wrote the first 25 problems from
>http://projecteuler.net/.
>
>My code is at
>http://www.fourtheye.org/cgi-bin/language.pl?language=forth. Some timing
>data and comparison with other languages is at
>http://www.fourtheye.org/projecteulertable.html. I used gforth and
>gforth-fast for timing.

It isn't too bad for the first 25 problem but the code of honour of
projecteuler user demands not to publish or even discuss problems
outside of the projecteuler forum.

The whole point of projecteuler is that you solve the problems
yourself, and not until then look into what other have done.
If you want a different way with exercises there are plenty of other
sites around, such as Google.

Groetjes Albert
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [next] | [standalone]


#20545

From"WJ" <w_a_x_man@yahoo.com>
Date2013-03-11 12:49 +0000
Message-ID<khkjsn$6pa$1@dont-email.me>
In reply to#20536
Problem 4.

Find the largest palindrome made from the product of two 3-digit
numbers.

Factor:

USING: math.parser locals ;

:: palindrome? ( n -- n/0 )
  n number>string dup reverse =
  n 0 ? ;

: prob4 ( -- n )
  0
  100 999 [a,b]
  [| i |
    100 999 [a,b]
    [| j |
      i j *  palindrome?  max
    ] each
  ] each
;

prob4 .
906609

[toc] | [prev] | [next] | [standalone]


#20555

From"WJ" <w_a_x_man@yahoo.com>
Date2013-03-11 19:44 +0000
Message-ID<khlc6c$tdq$1@dont-email.me>
In reply to#20545
WJ wrote:

> Problem 4.
> 
> Find the largest palindrome made from the product of two 3-digit
> numbers.
> 
> Factor:
> 
> USING: math.parser locals ;

USING: math.ranges math.parser locals ;

> 
> :: palindrome? ( n -- n/0 )
>   n number>string dup reverse =
>   n 0 ? ;
> 
> : prob4 ( -- n )
>   0
>   100 999 [a,b]
>   [| i |
>     100 999 [a,b]
>     [| j |
>       i j *  palindrome?  max
>     ] each
>   ] each
> ;
> 
> prob4 .
> 906609

[toc] | [prev] | [next] | [standalone]


#20546

From"WJ" <w_a_x_man@yahoo.com>
Date2013-03-11 13:54 +0000
Message-ID<khknm4$s4v$1@dont-email.me>
In reply to#20536
Problem 5.

What is the smallest positive number that is evenly divisible by all
of the numbers from 1 to 20?

Factor:

USING: locals math.ranges hashtables math.primes.factors ;
QUALIFIED: assocs

:: update-table ( key val table -- )
  key table
  [ [ val max ] [ val ] if* ]
  assocs:change-at ;

:: prob5 ( -- n )
  H{ } clone :> table
  2 20 [a,b]
  [ group-factors
    [ first2 table update-table ]
    each
  ]
  each
  1 table >alist [ first2 ^ * ] each ;

prob5 .
232792560

[toc] | [prev] | [next] | [standalone]


#20557

From"WJ" <w_a_x_man@yahoo.com>
Date2013-03-11 20:04 +0000
Message-ID<khldd4$576$1@dont-email.me>
In reply to#20536
> Find the difference between the sum of the squares of the first
> one hundred natural numbers and the square of the sum.
> 
> 006.fs
> 
> #! /usr/bin/gforth
> 
> : sumsq  ( n -- sumsq )
> ( returns the sum of the square of all integers to n )
> 0 swap 1+ 0 do
>   i dup * + 
> loop
> ;
> 
> : sqsum ( n -- sqsum )
> ( returns the square of the sum of all integers to n )
> dup 1+ * 2 / dup *
> ;
> 
> : pe006 ( -- )
> 100 dup sqsum swap sumsq - . cr
> ;
> 
> pe006

Factor:

USING: math.ranges ;

101 100 * 2/ sq
100 [1,b] 0 [ sq + ] reduce - .
25164150

[toc] | [prev] | [next] | [standalone]


#24192

From"WJ" <w_a_x_man@yahoo.com>
Date2013-07-06 05:31 +0000
Message-ID<kr8a3i$efv$1@dont-email.me>
In reply to#20557
WJ wrote:

> > Find the difference between the sum of the squares of the first
> > one hundred natural numbers and the square of the sum.
> > 
> > 006.fs
> > 
> > #! /usr/bin/gforth
> > 
> > : sumsq  ( n -- sumsq )
> > ( returns the sum of the square of all integers to n )
> > 0 swap 1+ 0 do
> >   i dup * + 
> > loop
> > ;
> > 
> > : sqsum ( n -- sqsum )
> > ( returns the square of the sum of all integers to n )
> > dup 1+ * 2 / dup *
> > ;
> > 
> > : pe006 ( -- )
> > 100 dup sqsum swap sumsq - . cr
> > ;
> > 
> > pe006
> 
> Factor:
> 
> USING: math.ranges ;
> 
> 101 100 * 2/ sq
> 100 [1,b] 0 [ sq + ] reduce - .
> 25164150

Julia:

julia> square( sum(1:100) ) - sum( map(square, 1:100) )
25164150

[toc] | [prev] | [next] | [standalone]


#20558

From"WJ" <w_a_x_man@yahoo.com>
Date2013-03-11 20:19 +0000
Message-ID<khle91$amr$1@dont-email.me>
In reply to#20536
> What is the 10 001st prime number?
> 
> 007.fs
> 
> #! /usr/bin/gforth
> 
> include isprime.fs
> 
> isprime.fs
> 
> : isprime ( n -- isprime )
> dup 2 mod ( check for even)
> if 
>   dup 8 < ( check for < 8 - all odd are prime apart from 1)
>   if 
>     dup 1 = 1+ ( check for == 1)
>   else
>     3 ( start with divisor of 3) 
>     begin
>       2dup mod ( check for n mod k)
>       if
>         2dup dup * > ( check for k*k > n)
>         if 
>           2 + 0  ( bump k and restart loop)
>         else 
>           1 1 ( set isprime and terminate loop)
>         then
>       else
>         0 1 ( clear isprime and terminate loop)
>       then
>     until
>     swap drop 
>   then
> else 
>   dup 2 = 0= 1+ ( check for == 2 )
> then
> swap drop ( drop all but isprime)
> ;
> : count_primes ( n -- primen )
> ( counts primes until the nth prime and returns it )
> 1 0 rot
> begin
>   rot dup isprime 
>   if
>     rot 1+ rot rot ( increment prime count )
>   then
>   1+ ( increment i )
>   rot rot 2dup = ( check for prime count == limit )
> until
> drop drop 1 -
> ;
> 
> : pe007
> 10001 count_primes . cr
> ;
> 
> pe007


Factor:

USING: math.primes ;

: nth-prime ( n -- prime )
  1 swap
  [ next-prime ]
  times ;

10,001 nth-prime .
104743

[toc] | [prev] | [next] | [standalone]


#20561

From"WJ" <w_a_x_man@yahoo.com>
Date2013-03-11 20:44 +0000
Message-ID<khlfo5$jn2$1@dont-email.me>
In reply to#20536
> Find the greatest product of five consecutive digits in the 1000-digit
> number.
> 
> 73167176531330624919225119674426574742355349194934
> 96983520312774506326239578318016984801869478851843
> 85861560789112949495459501737958331952853208805511
> 12540698747158523863050715693290963295227443043557
> 66896648950445244523161731856403098711121722383113
> 62229893423380308135336276614282806444486645238749
> 30358907296290491560440772390713810515859307960866
> 70172427121883998797908792274921901699720888093776
> 65727333001053367881220235421809751254540594752243
> 52584907711670556013604839586446706324415722155397
> 53697817977846174064955149290862569321978468622482
> 83972241375657056057490261407972968652414535100474
> 82166370484403199890008895243450658541227588666881
> 16427171479924442928230863465674813919123162824586
> 17866458359124566529476545682848912883142607690042
> 24219022671055626321111109370544217506941658960408
> 07198403850962455444362981230987879927244284909188
> 84580156166097919133875499200524063689912560717606
> 05886116467109405077541002256983155200055935729725
> 71636269561882670428252483600823257530420752963450
> 
> 008.fs
> 
> #! /usr/bin/gforth
> 
> create data 7 c, 3 c, 1 c, 6 c, 7 c, 1 c, 7 c, 6 c, 5 c, 3 c, 1 c, 3 c, 3 c,
> 0 c, 6 c, 2 c, 4 c, 9 c, 1 c, 9 c, 2 c, 2 c, 5 c, 1 c, 1 c, 9 c, 6 c, 7 c, 4 c,
> 4 c, 2 c, 6 c, 5 c, 7 c, 4 c, 7 c, 4 c, 2 c, 3 c, 5 c, 5 c, 3 c, 4 c, 9 c, 1 c,
> 9 c, 4 c, 9 c, 3 c, 4 c, 9 c, 6 c, 9 c, 8 c, 3 c, 5 c, 2 c, 0 c, 3 c, 1 c, 2 c, 
> 7 c, 7 c, 4 c, 5 c, 0 c, 6 c, 3 c, 2 c, 6 c, 2 c, 3 c, 9 c, 5 c, 7 c, 8 c, 3 c, 
> 1 c, 8 c, 0 c, 1 c, 6 c, 9 c, 8 c, 4 c, 8 c, 0 c, 1 c, 8 c, 6 c, 9 c, 4 c, 7 c, 
> 8 c, 8 c, 5 c, 1 c, 8 c, 4 c, 3 c, 8 c, 5 c, 8 c, 6 c, 1 c, 5 c, 6 c, 0 c, 7 c, 
> 8 c, 9 c, 1 c, 1 c, 2 c, 9 c, 4 c, 9 c, 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 6 c, 4 c, 
> 6 c, 7 c, 1 c, 0 c, 9 c, 4 c, 0 c, 5 c, 0 c, 7 c, 7 c, 5 c, 4 c, 1 c, 0 c, 0 c, 
> 2 c, 2 c, 5 c, 6 c, 9 c, 8 c, 3 c, 1 c, 5 c, 5 c, 2 c, 0 c, 0 c, 0 c, 5 c, 5 c, 
> 9 c, 3 c, 5 c, 7 c, 2 c, 9 c, 7 c, 2 c, 5 c, 7 c, 1 c, 6 c, 3 c, 6 c, 2 c, 6 c, 
> 9 c, 5 c, 6 c, 1 c, 8 c, 8 c, 2 c, 6 c, 7 c, 0 c, 4 c, 2 c, 8 c, 2 c, 5 c, 2 c, 
> 4 c, 8 c, 3 c, 6 c, 0 c, 0 c, 8 c, 2 c, 3 c, 2 c, 5 c, 7 c, 5 c, 3 c, 0 c, 4 c, 
> 2 c, 0 c, 7 c, 5 c, 2 c, 9 c, 6 c, 3 c, 4 c, 5 c, 0 c, 
> 
> : pe008
> 0 996 0 do 
>   5 0 do
>     i j data + + c@
>   loop
>   * * * * 2dup
>   <
>   if
>     swap 
>   then
>   drop
> loop
> . cr
> ;
> 
> pe008


Factor:

USING: math.parser grouping sequences.generalizations ;

0
"73167176531330624919225119674426574742355349194934"
"96983520312774506326239578318016984801869478851843"
"85861560789112949495459501737958331952853208805511"
"12540698747158523863050715693290963295227443043557"
"66896648950445244523161731856403098711121722383113"
"62229893423380308135336276614282806444486645238749"
"30358907296290491560440772390713810515859307960866"
"70172427121883998797908792274921901699720888093776"
"65727333001053367881220235421809751254540594752243"
"52584907711670556013604839586446706324415722155397"
"53697817977846174064955149290862569321978468622482"
"83972241375657056057490261407972968652414535100474"
"82166370484403199890008895243450658541227588666881"
"16427171479924442928230863465674813919123162824586"
"17866458359124566529476545682848912883142607690042"
"24219022671055626321111109370544217506941658960408"
"07198403850962455444362981230987879927244284909188"
"84580156166097919133875499200524063689912560717606"
"05886116467109405077541002256983155200055935729725"
"71636269561882670428252483600823257530420752963450"
20 nappend
5 clump
[ 1 group 1 [ string>number * ] reduce max ]
each .

40824

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.forth


csiph-web