[seqfan] Re: submitting a program, while preserving preformatted text

Donald Alan Morrison donmorrison at gmail.com
Sat Sep 4 21:03:30 CEST 2010


Did the attachment go through?  One thing I forgot to mention is the
program doesn't print the n column, only the a(n) column.  Changing
the format operation is easy enough though, as below:

%time
# python 2.6.X, sage 4.5.2, seq id:A100959
from os.path import expanduser
lo = 2
hi = 14 * 10^3
nonsemip = [1]
for a in xrange(lo,hi+1):
    lst = list(factor(a))
    if len(lst)==1:
        if lst[0][1]==2:
            continue
    elif len(lst)==2:
        if lst[0][1]==1 and lst[1][1]==1:
            continue
    nonsemip.append(a)
with open(expanduser("~/B100959.txt"), 'w') as fp:
    for i in xrange(10^4):
        print >> fp, "%d %d" % (i+1, nonsemip[i])
fp.close()
del(fp)

On Sat, Sep 4, 2010 at 11:52 AM, Donald Alan Morrison
<donmorrison at gmail.com> wrote:
> http://www.research.att.com/~njas/sequences/eishelp1.html
>
> I submitted a python/sage program, which requires preservation of
> indentation (because indents are implicit blocks, like curly braces in
> C).
>
> How do I preserve indentation, so it shows up correctly on the page?
>
> http://www.research.att.com/~njas/sequences/A100959
>
> Attached is a version with correct indentation and a fix to write the
> file to the current user's home directory, it also only uses 'w' mode.
>  (Assuming the seqfan list lets small attachments through, please see
> attached.)
>
> If you want to try out sage: http://sagemath.org/download.html
>
> Cheers,
> Don
>




More information about the SeqFan mailing list