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-2 of 2 results.

A253387 A "mod sequence" where a(n) is the eventual constant value attained by the sequence defined as b(1) = n, b(m) = (sum_{k=1..m-1} b(k)) mod m, with a(n) = -1 in case a constant run is not found.

Original entry on oeis.org

97, 97, 1, 1, 2, 2, 2, 2, 316, 316, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 12, 12, 4, 4, 4, 4, 12, 12, 11, 11, 11, 11, 316, 316, 11, 11, 316, 316, 316, 316, 6, 6, 316, 316, 316, 316, 316, 316, 316, 316, 97, 97, 316, 316, 316, 316, 13, 13, 316, 316, 13
Offset: 1

Views

Author

Jean-François Alcover, Dec 31 2014

Keywords

Examples

			a(5) = 2, because the b sequence is 5, 1, 0, 2, 3, 5, 2, 2, 2, 2, 2, ...
		

Crossrefs

Programs

  • Mathematica
    Clear[a]; constantLength = 10; kMax = 2000; a[n_] := a[n] = Module[{k}, Clear[b]; For[ b[1] = n; b[m_] := b[m] = Mod[Sum[b[j], {j, 1, m-1}], m]; k = constantLength, k <= kMax, k++, If[Equal @@ Table[b[k-j], {j, 0, constantLength-1}], Print["a(", n, ") = ", b[k], ", k = ", k - constantLength+1]; Return[b[k]]]]; Print["a(", n, ") = ", -1, ", k = ", k - constantLength+1, " constant run not found"]; Return[-1]]; Table[a[n], {n, 1, 100}]

A372865 a(n) = (Sum_{k = 1..n-1} k*a(k)) (mod n) with a(1) = 1.

Original entry on oeis.org

1, 1, 0, 3, 0, 3, 5, 4, 1, 9, 1, 6, 9, 7, 2, 15, 2, 9, 13, 10, 3, 21, 3, 12, 17, 13, 4, 27, 4, 15, 21, 16, 5, 33, 5, 18, 25, 19, 6, 39, 6, 21, 29, 22, 7, 45, 7, 24, 33, 25, 8, 51, 8, 27, 37, 28, 9, 57, 9, 30, 41, 31, 10, 63, 10, 33, 45, 34, 11, 69, 11, 36, 49, 37, 12, 75, 12, 39, 53, 40
Offset: 1

Views

Author

Peter Bala, May 15 2024

Keywords

Comments

Compare with A066910.
More generally, define a sequence {a(n, s) : n >= 1} with starting parameter s by a(n, s) = (Sum_{k = 1..n-1} k*a(k, s)) (mod n) with a(1, s) = s. The sequence {a(n, s)} is conjectured to be one of 3 types as illustrated by the following examples for s in [1..100].
1) It is easy to verify that the sequence {a(n, 8)} = {8, 0, 2, 2, 2, 2, ...} becomes constant at n = 3 and the sequence {a(n, 38)} = {38, 0, 2, 0, 4, 4, 4, ...} becomes constant at n = 5.
2) For s in {2, 5, 20, 21, 22, 31, 33, 34, 35, 36, 40, 42, 60, 65, 85, 87, 88, 92, 93, 97, 98, 100} the sequence {a(n, s)} appears to be quasipolynomial in n with 6 constituent polynomials of degree 1.
3) For the remaining values of s <= 100, the sequence {a(n, s)} appears to be an eventually periodic sequence with period 6, so again quasipolynomial in n with 6 constituent polynomials of degree 0. For example, an easy induction argument shows that {a(n, 3)} = {3, 1, 2, 3, 3, 2, 1, 1, 2, 3, 3, 2, 1, 1, 2, 3, 3, 2, 1, ...} has period 6 starting at n = 2.

Crossrefs

Programs

  • Maple
    a := proc(n, s) option remember; if n = 1 then s else irem(add(k*a(k, s), k = 1 .. n-1), n) end if; end proc:
    seq(a(n, 1), n = 1..80);
  • Mathematica
    CoefficientList[Series[x(x^8 + 4*x^7 + 4*x^6 + 2*x^5 + x^4 + 2*x^3 + x^2 + 2*x + 1)/((x + 1)^2*(x - 1)^2*(x^2 - x + 1)*(x^2 + x + 1)^2),{x,0,80}],x] (* Stefano Spezia, May 18 2024 *)
  • PARI
    lista(nn) = my(v=vector(nn)); v[1]=1; for(n=2, nn, v[n]=sum(k=1, n-1, k*v[k])%n); v; \\ Michel Marcus, May 18 2024

Formula

a(n) is quasipolynomial in n (proved by induction): a(6*n) = 3*n for n >= 1, and for n >= 0, a(6*n+1) = 4*n + 1, a(6*n+2) = 3*n + 1, a(6*n+3) = n, a(6*n+4) = 6*n + 3 and a(6*n+5) = n.
G.f.: A(x) = x*(x^8 + 4*x^7 + 4*x^6 + 2*x^5 + x^4 + 2*x^3 + x^2 + 2*x + 1)/((x + 1)^2*(x - 1)^2*(x^2 - x + 1)*(x^2 + x + 1)^2).
Showing 1-2 of 2 results.