# Re: Weird Numbers (#57)

**URL:** <https://www.ruby-forum.com/t/re-weird-numbers-57/49318>\
**Category:** Ruby\
**Created:** [December 2, 2005, 3:59pm UTC](https://www.ruby-forum.com/t/re-weird-numbers-57/49318 "2005-12-02T15:59:37Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![simon.kroeger.ext](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@simon.kroeger.ext](https://www.ruby-forum.com/u/simon.kroeger.ext)\
**Post date:** [December 2, 2005, 3:59pm UTC](https://www.ruby-forum.com/t/re-weird-numbers-57/49318/1 "2005-12-02T15:59:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![simon.kroeger.ext](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@simon.kroeger.ext](https://www.ruby-forum.com/u/simon.kroeger.ext)\
**Post date:** [December 2, 2005, 4:32pm UTC](https://www.ruby-forum.com/t/re-weird-numbers-57/49318/2 "2005-12-02T16:32:03Z")

</div>

> 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!  
[error](http://www.research.att.com/cgi-bin/access.cgi/as/njas/sequences/eisA.cgi?Anum=A006037)

See Also:

[Weird number - Wikipedia](http://en.wikipedia.org/wiki/Weird_number)  
[Weird Number -- from Wolfram MathWorld](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](http://www.theory.cs.uvic.ca/~cos/cos.html)

Is that possible in Ruby?

---

<div class="post-metadata">

**Author:** ![simon.kroeger.ext](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@simon.kroeger.ext](https://www.ruby-forum.com/u/simon.kroeger.ext)\
**Post date:** [December 2, 2005, 4:56pm UTC](https://www.ruby-forum.com/t/re-weird-numbers-57/49318/3 "2005-12-02T16:56:32Z")

</div>

If you download the Mathematica notebook file for “Weird Number” from  
this site:

[Weird Number -- from Wolfram MathWorld](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](http://library.wolfram.com/Explore/Publishing/NBtoPDF.jsp)

---

<div class="post-metadata">

**Author:** ![simon.kroeger.ext](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@simon.kroeger.ext](https://www.ruby-forum.com/u/simon.kroeger.ext)\
**Post date:** [December 4, 2005, 12:29am UTC](https://www.ruby-forum.com/t/re-weird-numbers-57/49318/4 "2005-12-04T00:29:24Z")

</div>

On Dec 3, 2005, at 5:22 PM, Nate 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…

James Edward G. II

---

<div class="post-metadata">

**Author:** ![simon.kroeger.ext](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@simon.kroeger.ext](https://www.ruby-forum.com/u/simon.kroeger.ext)\
**Post date:** [December 4, 2005, 12:25am UTC](https://www.ruby-forum.com/t/re-weird-numbers-57/49318/5 "2005-12-04T00:25:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![simon.kroeger.ext](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@simon.kroeger.ext](https://www.ruby-forum.com/u/simon.kroeger.ext)\
**Post date:** [December 4, 2005, 12:33am UTC](https://www.ruby-forum.com/t/re-weird-numbers-57/49318/6 "2005-12-04T00:33:27Z")

</div>

Nate wrote:

> Very confused,
> 
> -Nate

erm, if 2 is a divisor 836/2=418 should also be, hmm?

get some sleep 🙂

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

cheers

Simon

---

<div class="post-metadata">

**Author:** ![simon.kroeger.ext](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@simon.kroeger.ext](https://www.ruby-forum.com/u/simon.kroeger.ext)\
**Post date:** [December 4, 2005, 12:45am UTC](https://www.ruby-forum.com/t/re-weird-numbers-57/49318/7 "2005-12-04T00:45:34Z")

</div>

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

Thanks!

---

<div class="post-metadata">

**Author:** ![simon.kroeger.ext](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@simon.kroeger.ext](https://www.ruby-forum.com/u/simon.kroeger.ext)\
**Post date:** [December 4, 2005, 12:45am UTC](https://www.ruby-forum.com/t/re-weird-numbers-57/49318/8 "2005-12-04T00:45:34Z")

</div>

James Edward G. II wrote:

> On Dec 3, 2005, at 5:22 PM, Nate 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.

---

<div class="post-metadata">

**Author:** ![simon.kroeger.ext](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@simon.kroeger.ext](https://www.ruby-forum.com/u/simon.kroeger.ext)\
**Post date:** [December 4, 2005, 1:17am UTC](https://www.ruby-forum.com/t/re-weird-numbers-57/49318/9 "2005-12-04T01:17:58Z")

</div>

On 12/4/05, Nathan [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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

---

<div class="post-metadata">

**Author:** ![simon.kroeger.ext](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@simon.kroeger.ext](https://www.ruby-forum.com/u/simon.kroeger.ext)\
**Post date:** [December 4, 2005, 1:38am UTC](https://www.ruby-forum.com/t/re-weird-numbers-57/49318/10 "2005-12-04T01:38:09Z")

</div>

Paolo C. wrote:

> On 12/4/05, Nathan [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![simon.kroeger.ext](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@simon.kroeger.ext](https://www.ruby-forum.com/u/simon.kroeger.ext)\
**Post date:** [December 4, 2005, 4:51pm UTC](https://www.ruby-forum.com/t/re-weird-numbers-57/49318/11 "2005-12-04T16:51:29Z")

</div>

On Dec 2, 2005, at 9:31 AM, Dan D. 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](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… 😉

James Edward G. II

---

<div class="post-metadata">

**Author:** ![simon.kroeger.ext](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@simon.kroeger.ext](https://www.ruby-forum.com/u/simon.kroeger.ext)\
**Post date:** [December 4, 2005, 5:40pm UTC](https://www.ruby-forum.com/t/re-weird-numbers-57/49318/12 "2005-12-04T17:40:14Z")

</div>

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 G. II [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote: On Dec 2, 2005,  
at 9:31 AM, Dan D. 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](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… 😉

James Edward G. II
