Re: project euler #8

2018-06-07 Thread John SJ Anderson
one year old's thread for which there were proper > replies here - > https://www.nntp.perl.org/group/perl.beginners/2017/05/msg126502.html and here > - https://github.com/shlomif/project-euler/tree/master/project-euler/8 . just > let sleeping dogs rest. Some comments on your code: &

Re: project euler #8

2018-06-07 Thread Shlomi Fish
Hi, why did you resurrect a one year old's thread for which there were proper replies here - https://www.nntp.perl.org/group/perl.beginners/2017/05/msg126502.html and here - https://github.com/shlomif/project-euler/tree/master/project-euler/8 . just let sleeping dogs rest. Some comments on

Re: project euler #8

2018-06-06 Thread John W. Krahn
On Tue, 2017-05-16 at 14:01 +0800, derr...@thecopes.me wrote: I am working on problem #8 of the euler project. see below. > > > > The four adjacent digits in the 1000-digit number that have the > greatest product are 9 × 9 × 8 × 9 = 5832. > > 73167176531330624919225119674426574742355349194934

Re: project euler #8

2017-05-26 Thread lee
Shlomi Fish writes: > Hi lee, > > I decided to try to give you another chance to be educated, despite Uri's > conclusion in the other thread. Hopefully you won't let me down. He has made a lot of conclusions and decided not to say anything further. I know it can be difficult to convince me of s

Re: project euler #8

2017-05-25 Thread Shlomi Fish
Hi lee, I decided to try to give you another chance to be educated, despite Uri's conclusion in the other thread. Hopefully you won't let me down. On Thu, 25 May 2017 16:48:13 +0100 lee wrote: > Shlomi Fish writes: > > > [...] > >> >> while ( my $numbline = ) { > >> >> chomp $numbline;

Re: project euler #8

2017-05-25 Thread lee
Shlomi Fish writes: > [...] >> >> while ( my $numbline = ) { >> >> chomp $numbline; >> >> my @numbline = split //, $numbline; >> > >> > You're processing the input number line-by-line, but it's one whole number >> > and the products may span across more than one line. You need to slurp

Re: project euler #8

2017-05-25 Thread Shlomi Fish
Hi lee! On Thu, 25 May 2017 02:24:05 +0100 lee wrote: > Shlomi Fish writes: > > > Hi all! > > > > Resending because the original message does not appear to have arrived at > > the list. > > > > = > > > > Hi Derrick, > > > > On Tue, 16 May 2017 14:01:34 +0800 > > derr...@thecopes.me wrote:

Re: project euler #8

2017-05-24 Thread lee
Ok, here's one more: [...] unless($ad) { print " * $ad = 0\n"; $start = $digit; next DIGITS; } [...] You can skip right away to behind the 0 which has already been found within the current range of adjacency. lee writes: > Sorry, I was too fast and I got

Re: project euler #8

2017-05-24 Thread lee
Sorry, I was too fast and I got it all wrong. It goes like this: [...] my $adjacency = 13; my $maxprod = 0; my $start = 0; my $exceed = length($data); my $end = $exceed - $adjacency; DIGITS: while($start < $end) { my $prod = substr($data, $start, 1); print $prod; if($prod) { my $ad

Re: project euler #8

2017-05-24 Thread lee
Shlomi Fish writes: > Hi all! > > Resending because the original message does not appear to have arrived at the > list. > > = > > Hi Derrick, > > On Tue, 16 May 2017 14:01:34 +0800 > derr...@thecopes.me wrote: > >> Hi All, >> >> I am working on problem #8 of the euler project. see below. >>

Re: project euler #8

2017-05-16 Thread Shlomi Fish
On Tue, 16 May 2017 17:53:17 +0800 "derrick" wrote: > OK thanks, I understand now. I was reading 20 50-digit numbers rather than 1 > 1000-digit numbers. I knew it a fundamental misunderstanding somewhere. Thank > you again, > You're welcome! -- Shlomi > Derrick > > --

Re: project euler #8

2017-05-16 Thread derrick
OK thanks, I understand now. I was reading 20 50-digit numbers rather than 1 1000-digit numbers. I knew it a fundamental misunderstanding somewhere. Thank you again, Derrick --发件人:Shlomi Fish日 期:2017年05月16日 16:54:39收件人:抄  送:Beginn

Re: project euler #8

2017-05-16 Thread Shlomi Fish
Hi all! Resending because the original message does not appear to have arrived at the list. = Hi Derrick, On Tue, 16 May 2017 14:01:34 +0800 derr...@thecopes.me wrote: > Hi All, > > I am working on problem #8 of the euler project. see below. > > > I have the below solution below for thi

Re: project euler #8

2017-05-16 Thread Robertas Stankevič
What if you have not 1000 but 10-digit number, and you are asked to find max product of 4 adjacent digits. What answer will output your program for this test case: 11199 99111

project euler #8

2017-05-15 Thread derrick
Hi All, I am working on problem #8 of the euler project. see below. The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 8586156078911294