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.

Showing 1-8 of 8 results.

A001591 Pentanacci numbers: a(n) = a(n-1) + a(n-2) + a(n-3) + a(n-4) + a(n-5), a(0)=a(1)=a(2)=a(3)=0, a(4)=1.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 2, 4, 8, 16, 31, 61, 120, 236, 464, 912, 1793, 3525, 6930, 13624, 26784, 52656, 103519, 203513, 400096, 786568, 1546352, 3040048, 5976577, 11749641, 23099186, 45411804, 89277256, 175514464, 345052351, 678355061, 1333610936, 2621810068
Offset: 0

Views

Author

Keywords

Comments

Number of permutations satisfying -k <= p(i) - i <= r, i=1..n-4, with k=1, r=4. - Vladimir Baltic, Jan 17 2005
a(n) is the number of compositions of n-4 with no part greater than 5. - Vladimir Baltic, Jan 17 2005
The pentanomial (A035343(n)) transform of a(n) is a(5n+4), n >= 0. - Bob Selcoe, Jun 10 2014
a(n) is the number of ways to tile a strip of length n-4 with squares, dominoes, trominoes (of length 3), and rectangles with length 4 (tetraminoes) and length 5 (pentaminoes). - Wajdi Maaloul, Jun 21 2022

Examples

			n=2: a(14) = (1*1 + 2*1 + 3*2 + 4*4 + 5*8 + 4*16 + 3*31 + 2*61 + 1*120) = 464. - _Bob Selcoe_, Jun 10 2014
G.f. = x^4 + x^5 + 2*x^6 + 4*x^7 + 8*x^8 + 16*x^9 + 31*x^10 + 120*x^11 + ...
		

References

  • Silvia Heubach and Toufik Mansour, Combinatorics of Compositions and Words, CRC Press, 2010.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Row 5 of arrays A048887 and A092921 (k-generalized Fibonacci numbers).
Cf. A106303 (Pisano period lengths).
Cf. A035343 (pentanomial coefficients).

Programs

  • Magma
    a:=[0,0,0,0,1]; [n le 5 select a[n] else Self(n-1) + Self(n-2) + Self(n-3) + Self(n-4) + Self(n-5): n in [1..40]]; // Marius A. Burtea, Oct 03 2019
    
  • Maple
    g:=1/(1-z-z^2-z^3-z^4-z^5): gser:=series(g, z=0, 49): seq((coeff(gser, z, n)), n=-4..32); # Zerinvary Lajos, Apr 17 2009
    # second Maple program:
    a:= n-> (<<0|1|0|0|0>, <0|0|1|0|0>, <0|0|0|1|0>, <0|0|0|0|1>, <1|1|1|1|1>>^n)[1, 5]:
    seq(a(n), n=0..44);  # Alois P. Heinz, Apr 09 2021
  • Mathematica
    CoefficientList[Series[x^4/(1 - x - x^2 - x^3 - x^4 - x^5), {x, 0, 50}], x]
    a[0] = a[1] = a[2] = a[3] = 0; a[4] = a[5] = 1; a[n_] := a[n] = 2 a[n - 1] - a[n - 6]; Array[a, 37, 0]
    LinearRecurrence[{1, 1, 1, 1, 1}, {0, 0, 0, 0, 1}, 50] (* Vladimir Joseph Stephan Orlovsky, May 25 2011 *)
  • Maxima
    a(n):=mod(floor(10^((n-4)*(n+1))*10^(5*(n+1))*(10^(n+1)-1)/(10^(6*(n+1))-2*10^(5*(n+1))+1)),10^n); /* Tani Akinari, Apr 10 2014 */
    
  • PARI
    a=vector(100);a[4]=a[5]=1;for(n=6,#a,a[n]=a[n-1]+a[n-2]+a[n-3]+a[n-4]+a[n-5]);concat(0, a) \\ Charles R Greathouse IV, Jul 15 2011
    
  • PARI
    A001591(n,m=5)=(matrix(m,m,i,j,i==j-1||i==m)^n)[1,m] \\ M. F. Hasler, Apr 20 2018
    
  • PARI
    a(n)= {my(x='x, p=polrecip(1 - x - x^2 - x^3 - x^4 - x^5)); polcoef(lift(Mod(x, p)^n), 4); }
    vector(41, n, a(n-1)) \\ Joerg Arndt, May 16 2021
    
  • Python
    def pentanacci():
        a, b, c, d, e = 0, 0, 0, 0, 1
        while True:
            yield a
            a, b, c, d, e = b, c, d, e, a + b + c + d + e
    f = pentanacci()
    print([next(f) for  in range(100)]) # _Reza K Ghazi Apr 09 2021

Formula

G.f.: x^4/(1 - x - x^2 - x^3 - x^4 - x^5). - Simon Plouffe in his 1992 dissertation.
G.f.: Sum_{n >= 0} x^(n+4) * (Product_{k = 1..n} (k + k*x + k*x^2 + k*x^3 + x^4)/(1 + k*x + k*x^2 + k*x^3 + k*x^4)). - Peter Bala, Jan 04 2015
Another form of the g.f.: f(z) = (z^4-z^5)/(1-2*z+z^6); then a(n) = Sum_{i=0..floor((n-4)/6)} ((-1)^i*binomial(n-4-5*i,i)*2^(n-4-6*i)) - Sum_{i=0..floor((n-5)/6)} ((-1)^i*binomial(n-5-5*i,i)*2^(n-5-6*i)) with convention Sum_{i=m..n} alpha(i) = 0 for m > n. - Richard Choulet, Feb 22 2010
a(n) = Sum_{k=1..n} (Sum_{r=0..k} (binomial(k,r) * Sum_{m=0..r} (binomial(r,m) * Sum_{j=0..m} (binomial(m,j)*binomial(j,n-m-k-j-r))))), n > 0. - Vladimir Kruchinin, Aug 30 2010
Sum_{k=0..4*n} a(k+b)*A035343(n,k) = a(5*n+b), b >= 0.
a(n) = 2*a(n-1) - a(n-6). - Vincenzo Librandi, Dec 19 2010
a(n) = (Sum_{i=0..n-1} a(i)*A074048(n-i))/(n-4) for n > 4. - Greg Dresden and Advika Srivastava, Oct 01 2019
For k>0 and n>0, a(n+5*k) = A074048(k)*a(n+4*k) - A123127(k-1)*a(n+3*k) + A123126(k-1)*a(n+2*k) - A074062(k)*a(n+k) + a(n). - Kai Wang, Sep 06 2020
lim n->oo a(n)/a(n-1) = A103814. - R. J. Mathar, Mar 11 2024

A106297 Period of the Lucas 5-step sequence A074048 mod n.

Original entry on oeis.org

1, 1, 104, 6, 781, 104, 2801, 12, 312, 781, 16105, 312, 30941, 2801, 81224, 24, 88741, 312, 13032, 4686, 291304, 16105, 12166, 312, 3905, 30941, 936, 16806, 70728, 81224, 190861, 48, 1674920, 88741, 2187581, 312, 1926221, 13032, 3217864, 9372, 2896405
Offset: 1

Views

Author

T. D. Noe, May 02 2005, Nov 19 2006

Keywords

Comments

This sequence can differ from the corresponding Fibonacci sequence (A106303) only when n is a multiple of 2 or 599 because 9584 is the discriminant of the characteristic polynomial x^5-x^4-x^3-x^2-x-1 and the prime factors of 9584 are 2 and 599. [corrected by Avery Diep, Aug 25 2025]
a(n) divides A106303(n). - Avery Diep, Aug 25 2025

Crossrefs

Cf. A074048, A106303 (period of Fibonacci 5-step sequence mod n), A106273 (discriminant of the polynomial x^n-x^(n-1)-...-x-1).

Programs

  • Mathematica
    n=5; Table[p=i; a=Join[Table[ -1, {n-1}], {n}]; a=Mod[a, p]; a0=a; k=0; While[k++; s=Mod[Plus@@a, p]; a=RotateLeft[a]; a[[n]]=s; a!=a0]; k, {i, 50}]
  • Python
    from itertools import count
    def A106297(n):
        a = b = (5%n,1%n,7%n,3%n,15%n)
        s = sum(b) % n
        for m in count(1):
            b, s = b[1:] + (s,), (s+s-b[0]) % n
            if a == b:
                return m # Chai Wah Wu, Feb 22-27 2022

Formula

Let the prime factorization of n be p1^e1...pk^ek. Then a(n) = lcm(a(p1^e1), ..., a(pk^ek)).
Conjectures: a(5^k) = 781*5^(k-1) for k > 0. a(2^k) = 3*2^(k-1) for k > 1. If a(p) != a(p^2) for prime p > 2, then a(p^k) = p^(k-1)*a(p) for k > 0. - Chai Wah Wu, Feb 25 2022

A106304 Period of the Fibonacci 5-step sequence A001591 mod prime(n).

Original entry on oeis.org

6, 104, 781, 2801, 16105, 30941, 88741, 13032, 12166, 70728, 190861, 1926221, 2896405, 79506, 736, 8042221, 102689, 3720, 20151120, 2863280, 546120, 39449441, 48030024, 3690720, 29509760, 104060400, 37516960, 132316201, 28231632, 6384, 86714880, 2248090, 3128
Offset: 1

Views

Author

T. D. Noe, May 02 2005, Nov 19 2006

Keywords

Comments

This sequence is the same as the period of the Lucas 5-step sequence (A106298) mod prime(n) except for n=1 and 109, which correspond to the primes 2 and 599, because 9584 is the discriminant of the characteristic polynomial x^5-x^4-x^3-x^2-x-1 and the prime factors of 9584 are 2 and 599. We have a(n) < prime(n) for the primes in A106281.

Crossrefs

Cf. A106281 (primes p such that x^5-x^4-x^3-x^2-x-1 mod p has 5 distinct zeros).

Programs

  • Mathematica
    n=5; Table[p=Prime[i]; a=Join[Table[ -1, {n-1}], {n}]; a=Mod[a, p]; a0=a; k=0; While[k++; s=Mod[Plus@@a, p]; a=RotateLeft[a]; a[[n]]=s; a!=a0]; k, {i, 40}]
  • Python
    from itertools import count
    from sympy import prime
    def A106304(n):
        a = b = (0,)*4+(1 % (p:= prime(n)),)
        s = 1 % p
        for m in count(1):
            b, s = b[1:] + (s,), (s+s-b[0]) % p
            if a == b:
                return m # Chai Wah Wu, Feb 22-27 2022

Formula

a(n) = A106303(prime(n)).

Extensions

a(31)-a(33) from Chai Wah Wu, Feb 27 2022

A351657 Period of the Fibonacci n-step sequence mod n.

Original entry on oeis.org

1, 3, 13, 10, 781, 728, 137257, 36, 273, 212784, 28531167061, 42640
Offset: 1

Views

Author

Ilya Gutkovskiy, Feb 16 2022

Keywords

Comments

From Chai Wah Wu, Feb 23 2022: (Start)
a(14) = 92269645680
a(15) = 4976066589192413
a(16) = 136
a(18) = 306281976
(End)

Examples

			For n = 4, take the tetranacci sequence (A000078), 0, 0, 0, 1, 1, 2, 4, 8, 15, 29, 56, 108, 208, ... (mod 4), which gives 0, 0, 0, 1, 1, 2, 0, 0, 3, 1, 0, 0, 0, 1, 1, 2, ... This repeats a pattern of length 10, so a(4) = 10.
		

Crossrefs

Programs

  • Python
    from math import lcm
    from itertools import count
    from sympy import factorint
    def f(n,pe): # period of the Fibonacci n-step sequence mod pe
        a = b = (0,)*(n-1)+(1%pe,)
        s = 1 % pe
        for m in count(1):
            b, s = b[1:] + (s,), (s+s-b[0]) % pe
            if a == b:
                return m
    def A351657(n): return 1 if n == 1 else lcm(*(f(n,p**e) for p, e in factorint(n).items())) # Chai Wah Wu, Feb 23-27 2022

Formula

From Chai Wah Wu, Feb 22 2022: (Start)
Conjecture 1: a(p) = (p^p-1)/(p-1) for p prime, i.e., a(A000040(n)) = A001039(n).
Conjecture 2: a(2^k) = 2^(k-1)*(1+2^k) = A007582(k).
Conjecture 3 (which implies Conjectures 1 and 2): a(p^k) = (p^(p*k)-1)*p^(k-1)/(p^k-1) for k > 0 and prime p.
(End)

Extensions

a(11)-a(12) from Chai Wah Wu, Feb 22 2022

A106290 Number of different orbit lengths of the 5-step recursion mod n.

Original entry on oeis.org

1, 3, 4, 4, 2, 9, 2, 6, 7, 6, 2, 11, 2, 6, 8, 8, 2, 9, 3, 8, 8, 6, 4, 12, 3, 6, 10, 8, 3, 18, 2, 10, 8, 6, 4, 11, 2, 6, 8, 12, 2, 18, 4, 8, 14, 9, 4, 16, 3, 9, 8, 8, 2, 12, 4, 12, 10, 6, 3, 22
Offset: 1

Views

Author

T. D. Noe, May 02 2005

Keywords

Comments

Consider the 5-step recursion x(k) = (x(k-1)+x(k-2)+x(k-3)+x(k-4)+x(k-5)) mod n. For any of the n^5 initial conditions x(1), x(2), x(3), x(4) and x(5) in Zn, the recursion has a finite period. Each of these n^5 vectors belongs to exactly one orbit. In general, there are only a few different orbit lengths for each n. For n=8, there are 6 different lengths: 1, 2, 3, 6, 12 and 24. The maximum possible length of an orbit is A106303(n), the period of the Fibonacci 5-step sequence mod n.

Crossrefs

Cf. A106287 (orbits of 5-step sequences), A106309 (primes that yield a simple orbit structure in 5-step recursions).

Programs

  • Python
    from itertools import count,product
    def A106290(n):
        bset, tset = set(), set()
        for t in product(range(n),repeat=5):
            t2 = t
            for c in count(1):
                t2 = t2[1:] + (sum(t2)%n,)
                if t == t2:
                    bset.add(c)
                    tset.add(t)
                    break
                if t2 in tset:
                    tset.add(t)
                    break
        return len(bset) # Chai Wah Wu, Feb 22 2022

A181190 Maximal length of chain-addition sequence mod 10 with window of size n.

Original entry on oeis.org

1, 60, 124, 1560, 4686, 1456, 18744, 585936, 4882810, 212784
Offset: 1

Views

Author

Alexander Dashevsky (atanvarnoalda(AT)gmail.com), Oct 10 2010

Keywords

Comments

Chain addition mod 10 with window n: take an n-digit 'seed'. Take the sum of its digits mod 10 and append to the seed. Repeat with the last n digits of the string, until the seed appears again.
This sequence shows the lengths of the longest sequences for different window sizes.
a(1)-a(10) all occur for seed 1 (among others). If this is always true, the sequence continues: 406224, 12695306, 4272460934, 380859180, 122070312496, 518798826, 3433227539058. - Lars Blomberg, Feb 12 2013
Comment from Michel Lagneau, Jan 20 2017, edited by N. J. A. Sloane, Jan 24 2017: (Start)
If seed 1 is always as good as or better than any other, as seems likely, then this sequence has the following alternative description.
Consider the n initial terms of an infinite sequence S(k, n) of decimal digits given by 0, 0,..., 0, 1. The succeeding terms are given by the final digits in the sum of the n immediately preceding terms. The sequence lists the period of each sequence corresponding to n = 2, 3, ...
a(2) = period of A000045 mod 10 (Fibonacci numbers mod 10) = A001175(10).
a(3) = period of A000073 mod 10 (tribonacci numbers mod 10) = A046738(10).
a(4) = period of A000078 mod 10 (tetranacci numbers mod 10) = A106295(10).
a(5) = period of A001591 mod 10 (pentanacci numbers mod 10) = A106303(10).
a(6) = period of A001592 mod 10 (hexanacci numbers mod 10).
a(7) = period of A122189 mod 10 (heptanacci numbers mod 10).
a(8) = period of A079262 mod 10 (octanacci numbers mod 10).
a(4) = 1560 because the four initial terms 0, 0, 0, 1 => S(k, 4) = 0, 0, 0, 1, 1, 2, 4, 8, 5, 9, 6, 8, 8, 1, 3, 0, 2, 6, 1, 9, 8, ... (tetranacci numbers mod 10). This sequence is periodic with period 1560:
S(1560 + 1, 4) = S(1, 4) = 0,
S(1560 + 2, 4) = S(2, 4) = 0,
S(1560 + 3, 4) = S(3, 4) = 0,
S(1560 + 4, 4) = S(4, 4) = 1.
(End)

Examples

			For n=2, the longest sequence begins with '01' (among others):
01123583145943707741561785381909987527965167303369549325729101.
It is 60 digits long (not counting the second '01' at the end).
For n=3, one of the longest sequences begins again with '001':
00112473441944756893025746770415061742394699425184352079627546556679289964992013
48570291225960516297849144970639807524172091001 (124 digits long without the second '001').
		

Crossrefs

Extensions

a(8)-a(10) from Lars Blomberg, Feb 12 2013

A193994 Number of zeros in the period of Fibonacci 5-step sequence A001591 mod n.

Original entry on oeis.org

1, 4, 35, 7, 156, 70, 400, 12, 45, 624, 1580, 61, 2380, 1600, 5460, 18, 5220, 33, 684, 1092, 14000, 6320, 523, 52, 185, 9520, 48, 2800, 2465, 10920, 6075, 22, 55300, 20880, 62400, 28, 52060, 464, 83300, 1872, 70180, 28000, 1903, 11060, 7020, 1046, 22, 79
Offset: 1

Views

Author

T. D. Noe, Aug 18 2011

Keywords

Crossrefs

Cf. A106303 (period of Fibonacci 5-step sequence).

Programs

  • Mathematica
    n = 5; Table[a = Join[{1}, Table[0, {n - 1}]]; a = Mod[a, i]; a0 = a; k = 0; zeros = 0; While[k++; s = Mod[Plus @@ a, i]; a = RotateLeft[a]; If[s == 0, zeros++]; a[[n]] = s; a != a0]; zeros, {i, 100}]
  • Python
    from itertools import count
    def A193994(n):
        a = b = (0,)*4+(1 % n,)
        c, s = 0, 1 % n
        for m in count(1):
            b, s = b[1:] + (s,), (s+s-b[0])% n
            c += int(s==0)
            if a == b:
                return c # Chai Wah Wu, Feb 22-27 2022

A351889 Table T(n,k) read by downward antidiagonals: period of n-step Fibonacci numbers mod k, n >= 1, k >= 1.

Original entry on oeis.org

1, 1, 1, 1, 3, 1, 1, 8, 4, 1, 1, 6, 13, 5, 1, 1, 20, 8, 26, 6, 1, 1, 24, 31, 10, 104, 7, 1, 1, 16, 52, 312, 12, 728, 8, 1, 1, 12, 48, 130, 781, 14, 364, 9, 1, 1, 24, 16, 342, 312, 208, 16, 80, 10, 1, 1, 60, 39, 20, 2801, 728, 9372, 18, 91, 11, 1, 1, 10, 124, 78, 24, 342, 728, 195312
Offset: 1

Views

Author

Chai Wah Wu, Feb 24 2022

Keywords

Examples

			Table T(n,k) starts:
  1   1     1   1       1      1          1   1      1        1
  1   3     8   6      20     24         16  12     24       60
  1   4    13   8      31     52         48  16     39      124
  1   5    26  10     312    130        342  20     78     1560
  1   6   104  12     781    312       2801  24    312     4686
  1   7   728  14     208    728        342  28   2184     1456
  1   8   364  16    9372    728     137257  32   1092    18744
  1   9    80  18  195312    720      13680  36    240   585936
  1  10    91  20  488281    910    5764800  40    273  4882810
  1  11  8744  22   19344  96184      19152  44  26232   212784
  1  12  3851  24  406224  46212  109531200  48  11553   406224
		

Crossrefs

Programs

  • Python
    from functools import lru_cache
    from math import lcm
    from itertools import count
    from sympy import factorint
    @lru_cache(maxsize=None)
    def A351889_T(n,k): # computes the period of the n-step Fibonacci sequence mod k
        if len(fs := factorint(k)) <= 1:
            a = b = (0,)*(n-1)+(1 % k,)
            s = 1 % k
            for m in count(1):
                b, s = b[1:] + (s,), (s + s - b[0]) % k
                if a == b:
                    return m
        else:
            return lcm(*(A351889_T(n,p**e) for p, e in fs.items()))

Formula

T(1,k) = T(n,1) = 1.
T(2,k) = A001175(k).
T(3,k) = A046738(k).
T(4,k) = A106295(k) for k not a multiple of 563.
T(5,k) = A106303(k).
T(n,2) = n + 1 for n > 1.
T(n,3) = A337212(n).
T(n,n) = A351657(n).
T(n,p_1^e_1*...*p_m^e_m) = lcm(T(n,p_1^e_1),...,T(n,p_m^e_m)) for p_i distinct primes.
Conjecture 1: T(n,2^m) = (n+1)*2^(m-1) for n > 1.
Conjecture 2: For p prime, if T(n,p) != T(n,p^2) then T(n,p^k) = p^(k-1)T(n,p).
Conjecture 2 is true for n = 2, n = 3 and n = 4 (see [Wall, 1960], [Waddill, 1978] and [Waddill, 1992] resp.). It is easy to show that T(n,4) != n+1 for all n, and thus Conjecture 2 implies Conjecture 1.
Conjecture 3: T(p^m,p^k) = (p^(pm)-1)*p^(k-1)/(p^m-1) for p prime and k, m > 0.
Showing 1-8 of 8 results.