%I #34 Jul 22 2018 08:43:29
%S 7,8,31,57,60,168,288,381,528,840,930,342,1723,1848,46,468,3541,1240,
%T 33,5113,2664,6240,3444,7920,3169,10303,10713,11557,11991,991,2016,
%U 130,6256,1610,148,22800,24807,26733,4648,172,10680,32760,36673,37443,2156,3960,481,12432,226,26220,54523,8160,9680,63000
%N Length of period of Narayana sequence A000930 modulo n-th prime.
%H Chai Wah Wu, <a href="/A271901/b271901.txt">Table of n, a(n) for n = 1..10000</a>
%H H. T. Engstrom, <a href="https://doi.org/10.1090/S0002-9947-1931-1501585-5">On sequences defined by linear recurrence relations</a> Trans. Am. Math. Soc. 33 (1) (1931) 210-218.
%H K. Kirthi, <a href="http://arxiv.org/abs/1509.05745">Narayana Sequences for Cryptographic Applications</a>, arXiv preprint arXiv:1509.05745 [math.NT], 2015.
%H M. B. Nathanson, <a href="https://doi.org/10.1090/S0002-9939-1975-0364124-5">Linear recurrences and uniform distribution</a>, Proc. Amer. Math. Soc. 48 (1975), 289-291.
%H D. D. Wall, <a href="http://www.jstor.org/stable/2309169">Fibonacci series modulo m</a>, Amer. Math. Monthly, 67 (1960), 525-532.
%F a(n) = A271953(prime(n)). - _Joerg Arndt_, Apr 17 2016
%t 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];
%t Array[a, 100] (* _Jean-François Alcover_, Jul 22 2018, after _Charles R Greathouse IV_ *)
%o (Python)
%o from sympy import prime
%o def A271901(n):
%o p = prime(n)
%o i, a, b, c = 1, 1, 1, 2 % p
%o while a != 1 or b != 1 or c != 1:
%o i += 1
%o a, b, c = b, c, (a+c) % p
%o return i # _Chai Wah Wu_, Feb 26 2017
%o (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
%Y Cf. A000930, A271953.
%K nonn,easy
%O 1,1
%A _N. J. A. Sloane_, Apr 17 2016
%E a(1) corrected by _Altug Alkan_, Apr 17 2016
%E Terms a(24) and beyond from _Joerg Arndt_, Apr 17 2016
|