Community highlights
Background
Apractical number is a positive integer N such that all smaller positive integers can be represented as sums of distinct divisors of N. For example, 12 is a practical number because all the numbers from 1 to 11 can be expressed as sums of the divisors of 12, which are 1, 2, 3, 4, and 6. () However, 10 is not a practical number, because 4 and 9 cannot be expressed as a sum of 1, 2, and 5. For more detailed explanation and examples, see.
Challenge
Write a function that returns whether a given positive integer is a practical number.
practical(1) => truepractical(2) => truepractical(3) => falsepractical(10) => falsepractical(12) => true
You should be able to handle numbers up to 10,000 efficiently. The sum of all practical numbers up to 10,000 inclusive is 6,804,107. Test your code by verifying this value.
Optional bonus challenge
Consider the numbers X in the range 1 to 10,000 inclusive. The sum of all X such that 1019 + X is a practical number is 1,451,958. Find the sum of all X such that 1020 + X is a practical number. I found the section in the Wikipedia article useful here.
I do not have any plans to resume posting here regularly. I just saw the Numberphile video and thought it would make a good challenge.


Challenge
Assign every lowercase letter a value, from 1 fora to 26 forz. Given a string of lowercase letters, find the sum of the values of the letters in the string.
lettersum("") => 0lettersum("a") => 1lettersum("z") => 26lettersum("cab") => 6lettersum("excellent") => 100lettersum("microspectrophotometries") => 317Optional bonus challenges
Use for the optional bonus challenges.
microspectrophotometriesis the only word with a letter sum of 317. Find the only word with a letter sum of 319.How many words have an odd letter sum?
There are 1921 words with a letter sum of 100, making it the second most common letter sum. What letter sum is most common, and how many words have it?
zyzzyvaandbiodegradabilitieshave the same letter sum as each other (151), and their lengths differ by 11 letters. Find the other pair of words with the same letter sum whose lengths differ by 11 letters.cytotoxicityandunreservednesshave the same letter sum as each other (188), and they have no letters in common. Find a pair of words that have no letters in common, and that have the same letter sum, which is larger than 188. (There are two such pairs, and one word appears in both pairs.)The list of word
{ geographically, eavesdropper, woodworker, oxymorons }contains 4 words. Each word in the list has both a different number of letters, and a different letter sum. The list is sorted both in descending order of word length, and ascending order of letter sum. What's the longest such list you can find?
(This challenge is a repost of, originally posted by in May 2012.)
It's been fun getting a little activity going in here these last 13 weeks. However, this will be my last post to this subreddit for the time being. Here's hoping another moderator will post some challenges soon!
Example
Consider this 5x5 matrix of numbers:
123456789 752880530 826085747 576968456 721429729173957326 1031077599 407299684 67656429 965491941048156299 663035648 604085049 1017819398 325233271942914780 664359365 770319362 52838563 720059384472459921 662187582 163882767 987977812 394465693
If you select 5 elements from this matrix such that no two elements come from the same row or column, what is the smallest possible sum? The answer in this case is 1099762961 (123456789 + 96549194 + 663035648 + 52838563 + 163882767).
Challenge
Find the minimum such sum when selecting 20 elements (one from each row and column) of. The answer is a 10-digit number whose digits sum to 35.
There's no strict runtime requirement, but you must actually run your program all the way through to completion and get the right answer in order to qualify as a solution: a program that will eventually give you the answer is not sufficient.
Optional Bonus
What's the smallest sum you can find for? It's okay to give a result that's not optimal in this case. If you want to prove that you found a certain sum, you can you post the indices of each element you selected from each row in order. For the 5x5 example, for instance, you could post[0,4,1,3,2].
(This challenge is a repost of, originally posted by in June 2012. See that post for the formula to algorithmically generate the matrices if you prefer to do it that way.)
