[QUIZ] Weird Numbers (#57)

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.
>
>

please give an example of such a number.
   
  70,836,4030,5830,7192,7912,9272,10430,10570,10792,10990,
           11410,11690,12110,12530,12670,13370,13510,13790,13930,14770,
           15610,15890,16030,16310,16730,16870,17272,17570,17990,18410,
           18830,18970,19390,19670
  
On-Line Encyclopedia of Integer Sequences!
  http://www.research.att.com/cgi-bin/access.cgi/as/njas/sequences/eisA.cgi?Anum=A006037

  See Also:
   
  http://en.wikipedia.org/wiki/Weird_number
  http://mathworld.wolfram.com/WeirdNumber.html
   
  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:
   
  Combinatorial Object Server
  http://www.theory.cs.uvic.ca/~cos/cos.html
   
  Is that possible in Ruby?

···

---------------------------------
Yahoo! Personals
Skip the bars and set-ups and start using Yahoo! Personals for free

If you download the Mathematica notebook file for "Weird Number" from this site:
   
  http://mathworld.wolfram.com/WeirdNumber.html
   
  You can convert the notebook file to pdf with this utility:
   
  http://library.wolfram.com/Explore/Publishing/NBtoPDF.jsp

···

---------------------------------
Yahoo! Shopping
Find Great Deals on Gifts at Yahoo! Shopping

Dan Diebolt wrote:

>please give an example of such a number.

  70,836,4030,5830,7192,7912,9272,10430,10570,10792,10990,
           11410,11690,12110,12530,12670,13370,13510,13790,13930,14770,
           15610,15890,16030,16310,16730,16870,17272,17570,17990,18410,
           18830,18970,19390,19670

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

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... :wink:

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:

  Combinatorial Object Server
  http://www.theory.cs.uvic.ca/~cos/cos.html

  Is that possible in Ruby?

You're using the same factor twice in there. That doesn't seem right...

James Edward Gray II

···

On Dec 3, 2005, at 5:22 PM, Nate wrote:

When I factor 836, I come up with 2 * 2 * 11 * 19 = 836.

Nate wrote:

Dan Diebolt wrote:

please give an example of such a number.

70,836,4030,5830,7192,7912,9272,10430,10570,10792,10990,
          11410,11690,12110,12530,12670,13370,13510,13790,13930,14770,
          15610,15890,16030,16310,16730,16870,17272,17570,17990,18410,
          18830,18970,19390,19670

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?

get some sleep :slight_smile:

(and you missed some more: 1, 4, 38, 44, 76)

cheers

Simon

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:

Combinatorial Object Server
http://www.theory.cs.uvic.ca/~cos/cos.html

Is that possible in Ruby?

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... :wink:

James Edward Gray II

---------------------------------
Yahoo! Personals
Single? There's someone we'd like you to meet.
Lots of someones, actually. Yahoo! Personals

James Edward Gray II wrote:

> 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.

···

On Dec 3, 2005, at 5:22 PM, Nate wrote:

Ah ha. That's exactly what I was looking for.

Thanks!

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.

irb(main):001:0> (1..836).select{|d| 836 % d == 0}
=> [1, 2, 4, 11, 19, 22, 38, 44, 76, 209, 418, 836]

Mostly I just want to know if the list posted previously is accurate or
not.

I think it is.

Paolo

···

On 12/4/05, Nathan <nmorse@gmail.com> wrote:

Paolo Capriotti wrote:

···

On 12/4/05, Nathan <nmorse@gmail.com> wrote:

irb(main):001:0> (1..836).select{|d| 836 % d == 0}
=> [1, 2, 4, 11, 19, 22, 38, 44, 76, 209, 418, 836]

Simon's right. I definitely need more sleep.

Cheers,

-Nathan