OEIS program initialization service

David Wilson davidwwilson at comcast.net
Wed Jan 18 19:07:06 CET 2006


Something on the back of my mind.

There are many times when I would like to import a sequence into a program I am 
writing.  I end up having to mouse the sequence from the screen and waste time 
playing with the formatting to do so.  It would be nice if the OEIS could 
generate text files of sequences in various program languages suitable for 
downloading.

The programming languages I use most are Perl and C++.   It would be nice to be 
able to hit buttons on sequence output for A000040 and have it generate a text 
files such as

--------------------------------------------------
# A000040: The prime numbers.
@A000040 = (undef, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 
59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 
149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 
233, 239, 241, 251, 257, 263, 269, 271);
--------------------------------------------------

for inclusion in Perl programs, or

--------------------------------------------------
// A000040: The prime numbers.
const int A000040size = 59;
long long int A000040[A000040size] = { 0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 
31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 
113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 
199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271 };
--------------------------------------------------

for inclusion in C++ programs.  Clearly, similar initializations would be useful 
for Mathematica, Maple, Pari, etc.  Also, a simple list format such as
--------------------------------------------------
A000040 59 1
2
3
5
...
271
--------------------------------------------------

might be useful for program input.

These formats might be included in one big text file, or else in small text 
files generated by hitting a button per programming language.

Just an idea that would simplify life for us seqophiles.

--------------------------------
- David Wilson 






More information about the SeqFan mailing list