31 07 2010

As I´m working on, more than one, small projects of programming sequences from The On-Line Encyclopedia of Integer Sequences, and as I always try to document my code the best I can: I like to add comments and help information to it, but after many hours of “copy and paste”, and being aware that when you are trying to do something with a computer: if you feel that everything is repetitive and boring, then it is for sure, that you are using the wrong procedure, so then, I decided to create a very simple tools to make my life easier.

The PHP code of these two on-line applications is almost the same than the one of OEIS2BibTeX, but this time changed to provide the help code for PARI/GP or Mathematica OEIS sequences functions.

Both applications can be used in two different ways:

* Entering the Sequence Id number with a HTML form: in a POST METHOD, or
* With the Id Number supplied to the PHP code within the link, using ?sequence=valid_ID


1.1) HTML POST Method:

1.2) PHP Parameter:
Here you can change A000200 for the desired Sequence Id Number:


2.1) HTML POST Method:

2.2) PHP Parameter:

2.3) Mathematica Code using Import:

As Mathematica can access on-line data, these functions can do the job too inside any Mathematica Notebook or Package:

OEISSequenceDescription[seq_String]:=Module[{dataloaded = StringJoin[Import["" <> seq <> "&fmt=3","Data"]], first, last},
first = Flatten[StringPosition[dataloaded, "%N"], 1][[2]];
last = Select[StringPosition[dataloaded, "%"][[All, 1]], # > first&][[1]];
StringReplace[StringTake[dataloaded, {first + 10, last - 1}], "  " ~~ _ -> ""]]

OEISAddHelp[seq_String]:=ToExpression[StringJoin[seq, "::usage=\"",seq, ": ", OEISSequenceDescription[seq], "\""]]

[a]-073110-Adding Help to OEIS Sequences.nb


[1]-PARI/GP Development Headquarters – Programming in GP: other specific functions-addhelp
[3]-Wolfram Mathematica Documentation Center: Import
[4]-E.Pérez Herrero-OEIS Utilities Page@ OEIS Wiki