Number of Divisors

[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




Here's An interesting experiment - lay out 13 cards of a single suit face down in order Ace,  2, 3, ...Queen, King. Starting with card 1, turn over every card. Then starting with card 2, turn over every 2nd card, then starting with card 3 turn over every 3rd card, etc., until you turn over just the 13th card on the 13th pass.

After 6 passes

Which cards will be face up after 13 passes? Can you guess which cards would be face up if we had cards numbered 1 to 50? Can you explain why?  (Spoiler at bottom of page.)

Note that each card gets flipped a number of times related to the number of divisors that it has.   That should be enough of a hint to get you moving toward answering the above questions.

By the way, here is a general method for determining the number of unique divisors of a number without listing them all:  How many divisors are there for 72?

bulletWrite the prime factorization of the number, 72=23 X 32
bulletAdd 1  to the exponents of each of the factors and multiply the results.  The answer is d(N),  the number of unique divisors of the original number N.    For our example,   d(72)= 4x3=12.    

Download source code

Download executable program

bullet Spoiler
bulletSince all  cards started face down, any that land face up  will have been flipped an odd number of times.  And, since each flip represents a divisor, the face up cards have an odd number of divisors. . These  will always be perfect squares because squares are the only numbers with an odd number of divisors.  This is clear if we notice that divisors of a number, N,  always occur in pairs (the divisor, D,  and the quotient, Q satisfy  N = D x Q ).  Thus each new divisor will increase the total number of unique divisors by two, unless the divisor and the quotient are the same . in which case  the number is a perfect square and  number of  divisors  increases by one to an odd number.

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