# Re: Mutually-Recursive Functions

**URL:** <https://www.ruby-forum.com/t/re-mutually-recursive-functions/106241>\
**Category:** Ruby\
**Created:** [June 7, 2007, 8:11pm UTC](https://www.ruby-forum.com/t/re-mutually-recursive-functions/106241 "2007-06-07T20:11:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [June 7, 2007, 8:11pm UTC](https://www.ruby-forum.com/t/re-mutually-recursive-functions/106241/1 "2007-06-07T20:11:14Z")

</div>

From: bbiker [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]  
Sent: Thursday, June 07, 2007 12:00 PM

> I am not exactly sure what the OP was trying to do … except that it  
> has to do with Columns in Excel. It does seems to me to be fairly  
> complicated. If this off topic, please excuse.

[snip]

> leastSD = num\_col % 26  
> end  
> Not as efficient, but simpler:

def n2a\_col( num\_col )  
if (1…255).include?( num\_col )  
a = ‘A’  
( num\_col-1 ).times{ a = a.succ }  
a  
end  
end

[0, 1, 2, 26, 27, 250, 255, 256].each{ |n|  
puts “%3d =\> %s” % [n, n2a\_col( n ).inspect]  
}

#=\> 0 =\> nil  
#=\> 1 =\> “A”  
#=\> 2 =\> “B”  
#=\> 26 =\> “Z”  
#=\> 27 =\> “AA”  
#=\> 250 =\> “IP”  
#=\> 255 =\> “IU”  
#=\> 256 =\> nil
