If I got I right, 70 would be such a number.
(I hope this is no spoiler)
divisors = [1, 2, 5, 7, 10, 14, 35]
sum = 74
no combination of the divisors adds up to 70
cheers
Simon
···
-----Original Message-----
From: JB Eriksson [mailto:mrkode@gmail.com]
Sent: Friday, December 02, 2005 3:48 PM
To: ruby-talk ML
Subject: Re: [QUIZ] Weird Numbers (#57)
please give an example of such a number. english is my second
language, and
english math speak is more like my sixth language or so (below
german,swedish techspeak and english techspeak).
On 12/2/05, Ruby Quiz <james@grayproductions.net> wrote:
>
> The three rules of Ruby Quiz:
>
> 1. Please do not post any solutions or spoiler discussion
for this quiz
> until
> 48 hours have passed from the time on this message.
>
> 2. Support Ruby Quiz by submitting ideas as often as you can:
>
> http://www.rubyquiz.com/
>
> 3. Enjoy!
>
>
>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-=-=-=-=-=-=-=-=-=
>
> by Martin DeMello
>
> A weird number is defined as a number, n, such that the sum
of all its
> divisors
> (excluding n itself) is greater than n, but no subset of
its divisors sums
> up to
> exactly n.
>
> Write a program to find all the weird numbers less than a
given input.
>
>
I would like to see an iterator in Ruby that took as one of its arguments the On-Line Encyclopedia of Integer Sequences identifier (A006037). And also an iterator in Ruby for the Combinatorial Object Server:
I can see how 70 is a "weird number" (divisors 2 + 5 + 7 + 10 + 14 + 35
= 74 and no subset adds up to 70), but can someone explain to me how
836 is considered "weird"?
2 + 11 + 19 + 22 + 38 + 209 = 301
Am I missing a divisor, because last time I checked 301 < 836. When I
factor 836, I come up with 2 * 2 * 11 * 19 = 836. Is this just one of
those cases where the internet is *wrong*?
You bet. Use the openuri library to grab the page, parse out what you need, and yield results. It's not even hard. Give it a try and you'll learn a lot about Ruby...
James Edward Gray II
···
On Dec 2, 2005, at 9:31 AM, Dan Diebolt wrote:
I would like to see an iterator in Ruby that took as one of its arguments the On-Line Encyclopedia of Integer Sequences identifier (A006037). And also an iterator in Ruby for the Combinatorial Object Server:
I can see how 70 is a "weird number" (divisors 2 + 5 + 7 + 10 + 14 + 35
= 74 and no subset adds up to 70), but can someone explain to me how
836 is considered "weird"?
2 + 11 + 19 + 22 + 38 + 209 = 301
Am I missing a divisor, because last time I checked 301 < 836. When I
factor 836, I come up with 2 * 2 * 11 * 19 = 836. Is this just one of
those cases where the internet is *wrong*?
Very confused,
-Nate
erm, if 2 is a divisor 836/2=418 should also be, hmm?
I am not talking about screen scraping bits and pieces of information off web sites but rather having a library of combinatorial iterators wrapped up in classes: Combinations, Permutations, ... Debruijn Sequences. Ruby blocks & yield statements would be a great way to process each element of the combinatorial structure seperating the problems of 1) generating the next element of combinatorial structure from 2) processing each element of the combinatorial structure.
···
James Edward Gray II <james@grayproductions.net> wrote: On Dec 2, 2005, at 9:31 AM, Dan Diebolt wrote:
I would like to see an iterator in Ruby that took as one of its
arguments the On-Line Encyclopedia of Integer Sequences identifier
(A006037). And also an iterator in Ruby for the Combinatorial
Object Server:
You bet. Use the openuri library to grab the page, parse out what
you need, and yield results. It's not even hard. Give it a try and
you'll learn a lot about Ruby...
James Edward Gray II
---------------------------------
Yahoo! Personals
Single? There's someone we'd like you to meet.
Lots of someones, actually. Yahoo! Personals
> When I factor 836, I come up with 2 * 2 * 11 * 19 = 836.
You're using the same factor twice in there. That doesn't seem right...
True, the only factors of 836 are 2, 11, and 19. I just meant to point
out that those are definitely the only factors because 2^2 * 11^1 *
19^1 = 836. That said, does 836 have any other divisors besides 2, 11,
19, 22, 38, and 209? I don't see how it could, but I would love to be
proved wrong.
Mostly I just want to know if the list posted previously is accurate or
not.
True, the only factors of 836 are 2, 11, and 19. I just meant to point
out that those are definitely the only factors because 2^2 * 11^1 *
19^1 = 836. That said, does 836 have any other divisors besides 2, 11,
19, 22, 38, and 209? I don't see how it could, but I would love to be
proved wrong.