MacGregor's Cabbage patch

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]




Search WWW


As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.


Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. 


We receive a few cents from each purchase.  Thanks


Support DFF - Donate

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa 365 Puzzlers  Calendar 2017

Mensa 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)


Feedback:  Send an e-mail with your comments about this program (or anything else).

Search only




Problem Description

Mr. MacGregor always planted his cabbage patch in a square configuration. This summer he decided to plant extra for his rabbit friends and ended up planting an extra 47 cabbages.

How big was his patch last year and this year?

Background & Techniques

A computer is not really required to solve this puzzle, but it only takes a few lines of code to do so. 

Try it with pencil and paper before clicking on the  "Solve" button.   A little knowledge of factoring and prime numbers  will be helpful in solving the equation represented by the problem:

Thisyear2 - Lastyear2 = 47

I added a hint  as a comment over in the  Browse source extract  link if you get stuck.

The problem, by the way, is adapted  from the book Recreations in the Theory of Numbers, by Albert Beiler, Dover Publications.    Equations in number theory, such as this one, where solutions are restricted to integers  are known  as Diophantine equations (after  Diophantus of Alexandria,  apparently the guy considered to be the father of algebra). 


Running/Exploring the Program 

bulletBrowse source extract
bulletDownload source
bulletDownload  executable

Suggestions for Further Explorations

Recreations in the Theory of Numbers is a gem of a book if you like numbers.  The final chapter has 100 short puzzles like this one, all with solutions!   And the preceding  292 pages  provide a good background, balancing the "recreational" part with theory.    


Original Date: November 18, 2002 

Modified: May 15, 2018

  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright 2000-2018, Gary Darby    All rights reserved.