[Purdue-pm] Perl Weekly Challenge - 004
Ward, Mark Daniel
mdw at purdue.edu
Mon Apr 22 01:45:08 PDT 2019
Dear Mark,
Many thanks for sharing! These are interesting.
If you plan to share at large with the world, I see 3 tiny corrections
to what you sent.
1. In your email, you mentioned the link:
https://perlweeklychallenge.org/blog/perl-weekly-challenge-005/f
but I think the "f" at the end of the URL should be removed.
2. In this pdf file:
https://engineering.purdue.edu/~mark/pwc-004.pdf
you have this formula for Pi:
$$\pi = 4\sum_{k >= 0} -1^{k}\frac{1}{2k+1}$$
but the $-1^{k}$ looks strange. By order of operations, we should put
$-1$ into parenthesis, so that it looks like this:
$$\pi = 4\sum_{k >= 0} (-1)^{k}\frac{1}{2k+1}$$
3. In the summation of the formula above, the sum looks more natural if
you write $\sum_{k=0}^{\infty}$ or if you write $\sum_{k\geq 0}$.
Either way would look better than $\sum_{k >= 0}$. Just FYI.
I hope that those are helpful early-morning comments!
Again, thank you very much for sharing..... just wanted you to know that
we are reading what you are sending!
Best wishes,
Mark
On 4/22/19 1:14 AM, Mark Senn wrote:
> (See my blog entry at
> https://engineering.purdue.edu/~mark/pwc-004.pdf
> for the details of the following challenges.)
>
>
> Challenge #1:
> Write a script to output the same number of PI digits as the size of
> your script. Say, if your script size is 10, it should print
> 3.141592653.
>
> Perl 6 Solution Highlights:
> Find a rapidly converging series for pi and use FatRat (fat rationals)
> for "infinite precision integer fractions". I checked my code was
> working by comparing it with the first 1000 digits of pi that
> the Wolfram Language (Mathematica) uses.
>
>
> Challenge #2
> You are given a file containing a list of words (case insensitive 1 word
> per line) and a list of letters. Print each word from the file than can
> be made using only letters from the list. You can use each letter only
> once (though there can be duplicates and you can use each of them once),
> you don't have to use all the letters. (Disclaimer: The challenge was
> proposed by Scimon Proctor).
>
> Perl 6 Solution Highlights:
> Use the Perl 6 bag data structure. A bag is a set of which elements
> occur and how many times they occur. There is a commplete set of
> bag operators. "$word (<=) $letters" is true if all elements,
> including counts, of word are in letters.
>
>
> Next week's challenges are at
> https://perlweeklychallenge.org/blog/perl-weekly-challenge-005/f
> I find these to be good exercises.
>
> -mark
> _______________________________________________
> Purdue-pm mailing list
> Purdue-pm at pm.org
> https://mail.pm.org/mailman/listinfo/purdue-pm
More information about the Purdue-pm
mailing list