# Very Silly One Liner

**URL:** <https://www.ruby-forum.com/t/very-silly-one-liner/65899>\
**Category:** Ruby\
**Created:** [August 22, 2006, 8:27am UTC](https://www.ruby-forum.com/t/very-silly-one-liner/65899 "2006-08-22T08:27:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amin1426](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@amin1426](https://www.ruby-forum.com/u/amin1426)\
**Post date:** [August 22, 2006, 8:27am UTC](https://www.ruby-forum.com/t/very-silly-one-liner/65899/1 "2006-08-22T08:27:19Z")

</div>

Here is my very very silly one liner for the day…

ruby -e ‘100.times{|n| a,b=n.divmod 10;10.times{|c|;d=c_10+a;next unless  
d!=0&&n%d==0&&b==c_n/d;printf “%02d/%02d=%d\n”,n,d,n/d}}’  
00/10=0  
00/20=0  
00/30=0  
00/40=0  
00/50=0  
00/60=0  
00/70=0  
00/80=0  
00/90=0  
10/01=10  
11/11=1  
20/02=10  
22/22=1  
30/03=10  
33/33=1  
40/04=10  
44/44=1  
50/05=10  
55/55=1  
60/06=10  
64/16=4  
66/66=1  
70/07=10  
77/77=1  
80/08=10  
88/88=1  
90/09=10  
95/19=5  
98/49=2  
99/99=1

John C. Phone : (64)(3) 358 6639  
Tait Electronics Fax : (64)(3) 359 4632  
PO Box 1645 Christchurch Email : removed\_email\_address@domain.invalid  
New Zealand

Carter’s Clarification of Murphy’s Law.

“Things only ever go right so that they may go more spectacularly wrong  
later.”

From this principle, all of life and physics may be deduced.

---

<div class="post-metadata">

**Author:** ![amin1426](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@amin1426](https://www.ruby-forum.com/u/amin1426)\
**Post date:** [August 22, 2006, 11:35am UTC](https://www.ruby-forum.com/t/very-silly-one-liner/65899/2 "2006-08-22T11:35:34Z")

</div>

On 8/22/06, John C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Here is my very very silly one liner for the day…
> 
> ruby -e ‘100.times{|n| a,b=n.divmod 10;10.times{|c|;d=c_10+a;next unless  
> d!=0&&n%d==0&&b==c_n/d;printf “%02d/%02d=%d\n”,n,d,n/d}}’

> 11/11=1  
> 66/66=1  
> 70/07=10  
> 77/77=1  
> 80/08=10  
> 88/88=1  
> 90/09=10  
> 95/19=5  
> 98/49=2  
> 99/99=1

Took me a good minute to figure out what you were doing there 🙂 Cute,  
though I submit that  
n/d = 10 and n/d = 1 are artistically unsatisfying, particularly the  
former. Plus you miss a nice case…

ruby -rrational -e ‘100.times{|n| a,b=n.divmod  
10;10.times{|c|d=c_10+a;next unless (n!=d) && (b_d!=0) &&  
(b_d==c_n);printf “%02d/%02d=#{Rational(n,d)}\n”,n,d}}’

64/16=4  
65/26=5/2  
95/19=5  
98/49=2

martin
