"""
File contains various functions for creating strings of integers.

Examples:
>>> numstrI(2)
'1'
>>> numstrI(4)
'1 2 4 '
>>> numstrJ(2)
'1'
>>> numstrJ(3)
'1 2 4 '
"""


def numstrI(n):
    """
    Given an integer n > 0, returns string consisting of integers 1 through
     n inclusive.
    
    Examples:
        >>> numstrI(1)
        '1'
        >>> numstrI(3)
        '1 2 4 '
    """
    s = "1"
    for i in range(2,n + 1):
        s = s + " " + str(i)
    return(s)


def numstrJ(n):
    """
    Given an integer n > 0, returns string consisting of integers 1 through
     n inclusive.
    
    Examples:
        >>> numstrJ(1)
        '1'
        >>> numstrJ(3)
        '1 2 4 '
    """
    t = ["1"]
    for i in range(2,n + 1):
        t.append(" %1d" % (i,))
    return "".join(t)


if __name__ == "__main__":
    '''
    if len(sys.argv) != 2:
        print "usage: ", sys.argv[0], " <n>"
        sys.exit(1)
    
    if int(sys.argv[1]) < 1:
        print "error: n < 1"
        sys.exit(1)
    
    s = numstrI(int(sys.argv[1]))
    print s
    s = numstrJ(int(sys.argv[1]))
    print s
    '''
    import doctest
    print "blarg"
    doctest.testmod()

