PyPE solution to PE problem 32

Registered by Scott Armitage

PyPE solution to PE problem 32

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
Approved
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
Scott Armitage
Completed by
Scott Armitage

Related branches

Sprints

Whiteboard

    ProjectEuler.net problem 32
    ===========================

    We shall say that an n-digit number is pandigital if it makes use of all
    the digits 1 to n exactly once; for example, the 5-digit number, 15234, is
    1 through 5 pandigital.

    The product 7254 is unusual, as the identity, 39 * 186 = 7254, containing
    multiplicand, multiplier, and product is 1 through 9 pandigital.

    Find the sum of all products whose multiplicand/multiplier/product identity
    can be written as a 1 through 9 pandigital.

    HINT: Some products can be obtained in more than one way so be sure to only
    include it once in your sum.

    Solution
    --------

    It is relatively easy to show that the only multiplicand combinations are
    those with 1 and 4 digits or those with 2 and 3 digits. The resulting
    product must be 4 digits in either case.

    We brute-force an iteration over all values in this range, and check if
    combination of multiplicands and product form a pandigital identity. If
    so, we dd the product to a set of products. At the end, we sum this set
    to retrieve the solution.

    Answer
    ------

    45228

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.