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.

A104217 Period of Perrin (0,2,3,2,5,5,..., A001608) sequence mod n.

This page as a plain text file.
%I A104217 #31 Apr 25 2025 18:56:13
%S A104217 1,7,13,14,24,91,48,28,39,168,120,182,183,336,312,56,288,273,180,168,
%T A104217 624,840,22,364,120,1281,117,336,871,2184,993,112,1560,2016,48,546,
%U A104217 1368,1260,2379,168,1723,4368,231,840,312,154,2257,728,336,840,3744,2562
%N A104217 Period of Perrin (0,2,3,2,5,5,..., A001608) sequence mod n.
%C A104217 Analogy to A001175, Pisano periods (or Pisano numbers): period of Fibonacci numbers mod n AND to A046738 for Perrin sequence, where a(n)=a(n-2)+a(n-3)
%C A104217 It appears that the n such that n-1 divides a(n) is the set of primes of the form x^2+23*y^2 (A033217). The discriminant of the characteristic polynomial of the Perrin sequence is -23. - _T. D. Noe_, Feb 23 2007
%H A104217 T. D. Noe, <a href="/A104217/b104217.txt">Table of n, a(n) for n=1..1000</a>
%t A104217 Table[a={0,2,3}; a=a0=Mod[a, n]; k=0; While[k++; s=a[[2]]+a[[1]]; a=RotateLeft[a]; a[[ -1]]=Mod[s,n]; a!=a0]; k, {n,100}] (* _T. D. Noe_, Oct 10 2006 *)
%o A104217 (Python)
%o A104217 from math import lcm
%o A104217 from functools import lru_cache
%o A104217 from sympy import factorint
%o A104217 @lru_cache(maxsize=None)
%o A104217 def A104217(n):
%o A104217     if n < 4:
%o A104217         return (1,7,13)[n-1]
%o A104217     f = factorint(n).items()
%o A104217     if len(f) > 1:
%o A104217         return lcm(*(A104217(a**b) for a,b in f))
%o A104217     else:
%o A104217         k,x = 1, (0,2,3)
%o A104217         while x != (3,0,2):
%o A104217             k += 1
%o A104217             x = (x[1], x[2], (x[0]+x[1]) % n)
%o A104217         return k # _Chai Wah Wu_, Apr 25 2025
%Y A104217 Cf. A001175, A046738 and Perrin sequence A001608.
%K A104217 nonn
%O A104217 1,2
%A A104217 _Anthony C Robin_, Mar 14 2005
%E A104217 More terms from _T. D. Noe_, Oct 10 2006