cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A271901 Length of period of Narayana sequence A000930 modulo n-th prime.

Original entry on oeis.org

7, 8, 31, 57, 60, 168, 288, 381, 528, 840, 930, 342, 1723, 1848, 46, 468, 3541, 1240, 33, 5113, 2664, 6240, 3444, 7920, 3169, 10303, 10713, 11557, 11991, 991, 2016, 130, 6256, 1610, 148, 22800, 24807, 26733, 4648, 172, 10680, 32760, 36673, 37443, 2156, 3960, 481, 12432, 226, 26220, 54523, 8160, 9680, 63000
Offset: 1

Views

Author

N. J. A. Sloane, Apr 17 2016

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{p = Prime[n], a = 1, b = 1, c = 2, k = 1}, While[a != 1 || b != 1 || c != 1, {a, b, c} = {b, c, Mod[a + c, p]}; k++]; k];
    Array[a, 100] (* Jean-François Alcover, Jul 22 2018, after Charles R Greathouse IV *)
  • PARI
    a(n,p=prime(n))=my(a=1,b=1,c=2,k=1); while(a!=1 || b!=1 || c!=1, [a,b,c]=[b,c,(a+c)%p]; k++); k \\ Charles R Greathouse IV, Feb 26 2017
  • Python
    from sympy import prime
    def A271901(n):
        p = prime(n)
        i, a, b, c =  1, 1, 1, 2 % p
        while a != 1 or b != 1 or c != 1:
            i += 1
            a, b, c = b, c, (a+c) % p
        return i # Chai Wah Wu, Feb 26 2017
    

Formula

a(n) = A271953(prime(n)). - Joerg Arndt, Apr 17 2016

Extensions

a(1) corrected by Altug Alkan, Apr 17 2016
Terms a(24) and beyond from Joerg Arndt, Apr 17 2016