From 2e5d277c45d57539c366a711dfa675831d7a81f5 Mon Sep 17 00:00:00 2001 From: dcw Date: Fri, 17 May 2019 17:21:15 +0100 Subject: duncan white's challenge 8 solutions --- challenge-008/duncan-c-white/README | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'challenge-008/duncan-c-white/README') diff --git a/challenge-008/duncan-c-white/README b/challenge-008/duncan-c-white/README index fb3a863c80..7adef4a715 100644 --- a/challenge-008/duncan-c-white/README +++ b/challenge-008/duncan-c-white/README @@ -1,14 +1,16 @@ -Challenge 1: "Create a script which takes a list of numbers from -command line and print the same in the compact form. For example, if -you pass 1,2,3,4,9,10,14,15,16 then it should print the compact form -like 1-4,9,10,14-16.." +Challenge 1: "Write a script that computes the first five perfect +numbers. A perfect number is an integer that is the sum of its positive +proper divisors (all divisors except itself). Please check Wiki for +more information. First 4 are 6, 28, 496 and 8128" -Quite simple and dull problem. But ok, let's have a go. +My notes: Cute little problem, let's have a go. -Challenge 2: "Create a script to calculate Ramanujan's constant with at -least 32 digits of precision." -Never heard of this constant, seems to be e^(pi*sqrt(163)), which is -"very nearly an integer", I don't particularly care about abtruse mathematical -formulae. But ok, Perl's built in module biggrat will let you do this anyway, -specifying accuracy 32; see ch-2.sh for the oneliner. +Challenge 2: "Write a function, center, whose argument is a list of +strings, which will be lines of text. The function should insert spaces +at the beginning of the lines of text so that if they were printed, +the text would be centered, and return the modified lines." + +My notes: + +Another well-specified problem:-) -- cgit