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.

A073117 a(n+1) = a(n) + a(n) mod n; a(1) = 1.

Original entry on oeis.org

1, 1, 2, 4, 4, 8, 10, 13, 18, 18, 26, 30, 36, 46, 50, 55, 62, 73, 74, 91, 102, 120, 130, 145, 146, 167, 178, 194, 220, 237, 264, 280, 304, 311, 316, 317, 346, 359, 376, 401, 402, 435, 450, 470, 500, 505, 550, 583, 590, 592, 634, 656, 688, 740, 778
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 19 2002

Keywords

Comments

Conjecture (seems provable): More generally let a and b(1) be integers. If b(n+1) = b(n) + b(n) (mod(n+a)) there is an integer x(a,b(1)) such that b(n+1) = b(n) + x(a,b(1)) for n sufficiently large. We have x(0,1) = x(1,1) = x(2,1) = 97, x(3,1) = 1, x(4,1) = 3, x(5,1) = 3, x(6,1) = 6, ..., x(97,1) = 43, x(0,11) = 2, etc. - Benoit Cloitre, Aug 20 2002

Examples

			a(397) = 38606 = 2*97*199 = (2*199)*97 = 398*97 = (397+1)*97; a(397) mod 397 = (397*97 + 97) mod 397 = 97, a(398) = a(397) + a(397) mod 397 = (397+1)*97 + 97 = (398+1)*97, etc.: a(n+1) = a(n) + 97 for n >= 397.
		

Crossrefs

Cf. A066910. - Rémy Sigrist, Mar 24 2017

Programs

A094405 a(1) = 1; a(n) = (sum of previous terms) mod n.

Original entry on oeis.org

1, 1, 2, 0, 4, 2, 3, 5, 0, 8, 4, 6, 10, 4, 5, 7, 11, 1, 17, 11, 18, 10, 15, 1, 21, 11, 16, 26, 17, 27, 16, 24, 7, 5, 1, 29, 13, 17, 25, 1, 33, 15, 20, 30, 5, 45, 33, 7, 2, 42, 22, 32, 52, 38, 8, 2, 47, 23, 32, 50, 25, 35, 55, 31, 46, 10, 3, 57, 29, 41, 65, 41, 64, 36, 53, 11, 2, 62, 26
Offset: 1

Views

Author

Chuck Seggelin (seqfan(AT)plastereddragon.com), Jun 03 2004

Keywords

Comments

Theorem. For all values of n>=397, a(n)=97. Proof. Let s(n) denote Sum[a(i), i=1..n-1]. Calculation shows that s(397)=38606=397*97+97. Thus a(397)=397*97+97 mod 397=97. Then s(398)=s(397)+97=398*97+97, giving a(398)=97. A simple inductive argument shows that a(397+k)=97 for all integers k>=0. - John W. Layman, Jun 07 2004
Conjecture: For any seed a(1) the sequence "a(n) = (sum of previous terms) mod n" ends with repeating constant. This is true for a(1) = 1,...,941. - Zak Seidov, Feb 24 2006
Essentially the same as A066910. [From R. J. Mathar, Sep 05 2008]

Examples

			a(4) = 0 because the previous terms 1, 1, 2 sum to 4 and 4 mod 4 is 0. a(5) = 4 because the previous terms 1, 1, 2, 0 sum to 4 and 4 mod 5 is 4.
		

Programs

  • Maple
    L := [1]; s := 1; p := 2; while (nops(L) < 90) do; if 1>0 then; t := s mod p; L := [op(L),t]; s := s+t; p := p+1; fi; od; L;

A215451 a(0)=1, a(n) = (sum of previous terms) mod (a(n-1)+n).

Original entry on oeis.org

1, 1, 2, 4, 0, 3, 2, 4, 5, 8, 12, 19, 30, 5, 1, 1, 13, 21, 15, 11, 3, 17, 22, 20, 0, 20, 10, 28, 54, 0, 2, 4, 14, 23, 33, 0, 12, 28, 52, 45, 35, 48, 88, 61, 42, 36, 35, 70, 16, 1, 8, 41, 3, 21, 0, 5, 18, 23, 43, 17, 1, 41, 65, 111, 149, 25, 1, 53, 29, 63, 98, 102, 154, 5
Offset: 0

Views

Author

Alex Ratushnyak, Aug 11 2012

Keywords

Comments

Indices of 0's: 4, 24, 29, 35, 54, 267, 5284, 17827, 43631, 120871, 843813, 1854903, 2226536, 4208775, 5525594, ...
Indices of 1's: 0, 1, 14, 15, 49, 60, 66, 116, 331, 6053, 23760, 288502, 496670, 4281666, ...
Indices such that a(n)=n: 1, 2, 22, 315, 1172, 1441, 1846, 2140, 47376, 593870, 16538298, 111824649, 565597433, 791186876, ...

Crossrefs

Programs

  • Mathematica
    nxt[{n_,t_,a_}]:=Module[{c=Mod[t,a+n+1]},{n+1,t+c,c}]; NestList[nxt,{0,1,1},80][[All,3]] (* Harvey P. Dale, Dec 30 2017 *)
  • Python
    s = a = 1
    for n in range(1,333):
        print(a, end=', ')
        a = s % (a+n)
        s += a

Formula

a(0)=1, a(n) = (a(0)+...+a(n-1)) mod (a(n-1)+n).

A215452 a(1)=1, a(n) = (sum of previous terms) mod (a(n-1) + n).

Original entry on oeis.org

1, 1, 2, 4, 8, 2, 0, 2, 9, 10, 18, 27, 4, 16, 11, 7, 2, 4, 13, 9, 0, 18, 4, 4, 2, 10, 3, 5, 26, 54, 21, 32, 4, 29, 42, 14, 10, 44, 57, 44, 63, 6, 5, 10, 52, 23, 32, 44, 64, 74, 71, 33, 18, 60, 93, 29, 46, 48, 60, 84, 38, 26, 39, 46, 83, 81, 25, 59, 93, 22, 47, 24, 34, 53
Offset: 1

Views

Author

Alex Ratushnyak, Aug 11 2012

Keywords

Comments

Indices of 0's: 7, 21, 956, 1576, 1964, 55346, 70460, 99845, 399114, 544095, 35321849, 77073660, ...
Indices of 1's: 1, 2, 129, 193, 262, 4495, 99781, 651856, 35351437, ...
Indices such that a(n)=n: 1, 4, 9, 10, 32, 176, 266, 414, 432, 440, 858, 5953, 6030, 15146, 1408096, 3138130, 35659404, 44722350, 109021513, 790542727, ...

Crossrefs

Programs

  • Maple
    s:= proc(n) option remember; `if`(n<1, 0, s(n-1)+a(n)) end:
    a:= proc(n) option remember; `if`(n=1, 1, irem(s(n-1), a(n-1)+n)) end:
    seq(a(n), n=1..74);  # Alois P. Heinz, Jun 16 2025
  • Mathematica
    nxt[{t_,n_,a_}]:={t+a,n+1,Mod[t+a,a+n+1]}; NestList[nxt,{0,1,1},80][[All,3]] (* Harvey P. Dale, Sep 01 2016 *)
  • Python
    s = a = 1
    for n in range(2,333):
        print(a, end=", ")
        a = s % (a+n)
        s += a

Formula

a(1)=1, a(n) = (a(0)+...+a(n-1)) mod (a(n-1)+n).

A330249 a(0) = 0; for n > 0, a(n) = n + a((Sum_{k=0..n-1} a(k)) mod n).

Original entry on oeis.org

0, 1, 3, 4, 4, 8, 9, 8, 16, 25, 26, 19, 16, 38, 39, 24, 16, 18, 22, 38, 59, 45, 81, 61, 28, 41, 67, 66, 95, 37, 69, 112, 40, 71, 50, 147, 183, 77, 75, 120, 62, 91, 119, 104, 94, 116, 55, 63, 70, 196, 145, 75, 92, 91, 170, 110, 176, 177, 241, 109
Offset: 0

Views

Author

Samuel B. Reid, Dec 06 2019

Keywords

Examples

			a(1) = 1 + a(0 mod 1) = 1.
a(2) = 2 + a((0+1) mod 2) = 3.
a(3) = 3 + a((0+1+3) mod 3) = 4.
a(4) = 4 + a((0+1+3+4) mod 4) = 4.
		

Crossrefs

Programs

  • Mathematica
    a[0] = 0; a[n_] := a[n] = n + a[Mod[Sum[a[k], {k, 0, n-1}], n]]; Array[a, 100, 0] (* Amiram Eldar, Dec 07 2019 *)
  • PARI
    lista(nn) = {my(v=vector(nn+1), s=0); v[1]=0; for(n=1, nn, v[n+1]=n+v[s%n+1]; s+=v[n+1]); v; } \\ Jinyuan Wang, Dec 07 2019

A330256 a(0) = 0; for n > 0, a(n) = n - a((Sum_{k=0..n-1} a(k)) mod n).

Original entry on oeis.org

0, 1, 1, 2, 4, 3, 3, 7, 5, 4, 10, 4, 7, 6, 13, 5, 12, 16, 12, 18, 14, 21, 9, 11, 10, 14, 22, 15, 14, 28, 9, 10, 23, 31, 24, 33, 22, 15, 37, 24, 16, 40, 14, 34, 37, 36, 43, 23, 34, 42, 13, 18, 37, 50, 17, 18, 32, 40, 40, 19, 46, 57, 39, 59, 30, 15, 32, 21, 11, 32, 40, 65, 32, 62, 41, 58, 63, 60
Offset: 0

Views

Author

Samuel B. Reid, Dec 07 2019

Keywords

Examples

			a(1) = 1 - a(0 mod 1) = 1.
a(2) = 2 - a((0+1) mod 2) = 1.
a(3) = 3 - a((0+1+1) mod 3) = 2.
a(4) = 4 - a((0+1+1+2) mod 4) = 4.
		

Crossrefs

Programs

  • Mathematica
    a[0] = 0; a[n_] := a[n] = n - a[Mod[Sum[a[k], {k, 0, n - 1}], n]]; Array[a, 100, 0] (* Amiram Eldar, Dec 07 2019 *)
  • PARI
    s=0; for (n=1, #(a=vector(78)), print1 (a[n]=if (n==1, 0, (n-1)-a[1+(s%(n-1))])", "); s+=a[n]) \\ Rémy Sigrist, Dec 08 2019

A337307 a(1) = 1; a(n) = 1 + Product_{k=1..n-1} a(k) (mod n-1).

Original entry on oeis.org

1, 1, 2, 3, 3, 4, 1, 3, 1, 1, 7, 6, 1, 12, 1, 10, 1, 12, 1, 3, 1, 1, 21, 12, 1, 6, 21, 1, 1, 15, 1, 20, 1, 31, 15, 1, 1, 32, 13, 1, 1, 18, 1, 7, 25, 1, 17, 38, 1, 1, 1, 1, 1, 26, 1, 6, 1, 1, 29, 47, 1, 42, 1, 1, 1, 1, 61, 26, 1, 25, 1, 21, 1, 64, 21, 1, 1, 29, 1, 18
Offset: 1

Views

Author

Matt Donahoe, Aug 22 2020

Keywords

Comments

Note that the running product for each a(n) is incrementally computed mod n-1.

Crossrefs

Inspired by A066910.
Cf. A129871 (without the mod operation).

Programs

  • Mathematica
    a[1] = 1; a[n_] := a[n] = 1 + Mod[Product[a[k], {k, 1, n - 1}], n - 1]; Array[a, 100] (* Amiram Eldar, Aug 22 2020 *)
  • PARI
    lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, nn, va[n] = 1 + prod(k=1, n-1, va[k]) % (n-1);); va;} \\ Michel Marcus, Aug 23 2020
  • Python
    def f(n):
        if n == 1: return 1
        a = 1
        for k in range(1, n):
            a = a * f(k) % (n - 1)
        return a + 1
    

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