From 9340549bbd9f58ad0c20b89cc69a9162820916ca Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Sun, 13 Mar 2011 14:43:06 -0700 Subject: [PATCH] Fix up the comments in one.adb and add the problem spec --- one.adb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/one.adb b/one.adb index 55aabaf..269ba1f 100644 --- a/one.adb +++ b/one.adb @@ -1,6 +1,10 @@ -- -- Project Euler problem #1 -- +-- If we list all the natural numbers below 10 that are multiples of 3 or 5, +-- we get 3, 5, 6 and 9. The sum of these multiples is 23. +-- +-- Find the sum of all the multiples of 3 or 5 below 1000. with Ada.Containers.Vectors, Ada.Command_Line, @@ -14,11 +18,11 @@ procedure One is package Bucket is new Ada.Containers.Vectors (Index_Type => Natural, Element_Type => Natural); -- - -- Print out multiples of 3 and 5 from 0 to the `Upper` + -- Return a `Vector` with all the multiples of 3 *or* 5 from 1 until + -- `Upper` (non-inclusive) function Multiples (Upper : in Natural) return Bucket.Vector is Numbers : Bucket.Vector; begin - -- Non-inclusive for Index in 1 .. (Upper - 1) loop if (Index mod 3) = 0 then Bucket.Append (Numbers, Index);