OEIS Challenge - Sequenze numeri interi

Area di interesse: Matematica

Un utile strumento a disposizione dei matematici è OEIS, l’enciclopedia online delle sequenze intere. Il sito permette di scrivere in input una sequenza di numeri interi come 1,2,3,6,11,23,47,106,235, e il sito proverà a ritornare delle ricorrenze numeriche che la generano, più altre informazioni come gli articoli scientifici che ne parlano:

oeis-9823

Scriviamo qua qualche spunto per il progetto:

  • fare dei widget in Jupyter che permettano all’utente di inserire una sequenza numerica, poi

  • con la libreria request spiegata in tutorial Integrazione dati SoftPython, chiamare le API di OEIS e ottenere dati sulla sequenza, in formato testuale nativo (più difficile da parsare) o JSON (più semplice)

  • se si ottiene una ricorrenza, fare un plot dei punti precalcolati forniti

  • provare a fare un parser (anche con regex, vedere tutorial Ricerca in SoftPython) che estrae nomi di autore dalla sezione references e li visualizza in un widget (tipo un VBox di Label):

"reference": [
    "F. Bergeron, G. Labelle and P. Leroux, Combinatorial Species and Tree-Like Structures, Camb. 1998, p. 279.",
    "N. L. Biggs et al., Graph Theory 1736-1936, Oxford, 1976, p. 49.",
    "A. Cayley, On the analytical forms called trees, with application to the theory of chemical combinations, Reports British Assoc. Advance. Sci. 45 (1875), 257-305 = Math. Papers, Vol. 9, 427-460 (see p. 459).",
    "S. R. Finch, Mathematical Constants, Cambridge, 2003, pp. 295-316.",
    "J. L. Gross and J. Yellen, eds., Handbook of Graph Theory, CRC Press, 2004; p. 526.",

Esempi API OEIS

Esempio (tagliato) di dati già ben parsato in JSON: http://oeis.org/search?fmt=json&q=1,2,3,6,11,23,47,106,235

{
    "greeting": "Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/",
    "query": "1,2,3,6,11,23,47,106,235",
    "count": 1,
    "start": 0,
    "results": [
        {
            "number": 55,
            "id": "M0791 N0299",
            "data": "1,1,1,1,2,3,6,11,23,47,106,235,551,1301,3159,7741,19320,48629,123867,317955,823065,2144505,5623756,14828074,39299897,104636890,279793450,751065460,2023443032,5469566585,14830871802,40330829030,109972410221,300628862480,823779631721,2262366343746,6226306037178",
            "name": "Number of trees with n unlabeled nodes.",
            "comment": [
                "Also, number of unlabeled 2-gonal 2-trees with n 2-gons.",
                "Main diagonal of A054924.",
                "Left border of A157905. - _Gary W. Adamson_, Mar 08 2009",
                "From _Robert Munafo_, Jan 24 2010: (Start)",
                "Also counts classifications of n items that require exactly n-1 binary partitions; see Munafo link at A005646, also A171871 and A171872.",
                "The 11 trees for n = 7 are illustrated at the Munafo web link.",

Esempio (tagliato) di dati in formato interno: http://oeis.org/search?fmt=text&q=1,1,1,5,3,60,487

# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/

Search: seq:1,1,1,5,3,60,487
Showing 1-1 of 1

%I A007299 M3736
%S A007299 1,1,1,1,5,3,60,487,13710027
%N A007299 Number of Hadamard matrices of order 4n.
%C A007299 More precisely, number of inequivalent Hadamard matrices of order n if two matrices are considered equivalent if one can be obtained from the other by permuting rows, permuting columns and multiplying rows or columns by -1.
%C A007299 The Hadamard conjecture is that a(n) > 0 for all n >= 0. - _Charles R Greathouse IV_, Oct 08 2012

Per dettagli sul formato, vedere:

Se il parsing diretto non vi entusiasma, potete anche provare ad usare la libreria PyOEIS

[ ]: