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-10 of 13 results. Next

A366470 a(n) = A364054(n-1) mod prime(n-1).

Original entry on oeis.org

1, 0, 1, 4, 4, 2, 2, 0, 15, 3, 1, 26, 26, 24, 24, 18, 18, 16, 16, 12, 12, 6, 81, 81, 73, 73, 71, 63, 57, 57, 29, 29, 23, 23, 13, 13, 1, 158, 154, 154, 148, 148, 138, 138, 134, 134, 122, 122, 118, 118, 114, 114, 112, 112, 106, 106, 100, 100, 94, 94, 92
Offset: 2

Views

Author

N. J. A. Sloane, Oct 21 2023

Keywords

Crossrefs

Programs

  • Mathematica
    nn = 2^20; c[] := False; m[] := 0; j = 1; c[0] = c[1] = True;
      Monitor[Do[p = Prime[n - 1]; r = Mod[j, p];
        While[Set[k, p m[p] + r ]; c[k], m[p]++];
        Set[{a[n - 1], c[k], j}, {r, True, k}], {n, 2, nn + 1}], n];
    Array[a, nn] (* Michael De Vlieger, Oct 27 2023 *)
  • Python
    from itertools import count, islice
    from sympy import nextprime
    def A366470_gen(): # generator of terms
        a, aset, p = 1, {0,1}, 2
        while True:
            yield a
            for b in count(a,p):
                if b not in aset:
                    aset.add(b)
                    a = b%(p:=nextprime(p))
                    break
    A366470_list = list(islice(A366470_gen(),30)) # Chai Wah Wu, Oct 22 2023

Formula

A364054(n) = A366475(n)*prime(n-1) + a(n) for n > 1. - Michael De Vlieger, Mar 06 2024

A366475 a(n) = (A364054(n) - A366470(n))/prime(n-1).

Original entry on oeis.org

1, 2, 2, 0, 1, 0, 1, 2, 2, 1, 2, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 3, 0, 2, 0, 1, 0, 1, 0, 2, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 0, 1, 2, 2, 1, 2, 1, 2, 0, 1, 2, 0, 2, 0
Offset: 2

Views

Author

N. J. A. Sloane, Oct 26 2023

Keywords

Comments

a(29) = 3. When, if ever, does 4 appear?
Answer: a(28025) = 4. - Michael De Vlieger, Oct 26 2023

Examples

			   n p(n-1)  x   y  a(n)  [x = A364054(n), y = A366470(n)]
   1   (1)   1   -   -    [a(n) = (x-y)/p(n-1)]
   2    2    3   1   1
   3    3    6   0   2
   4    5   11   1   2
   5    7    4   4   0
   6   11   15   4   1
   7   13    2   2   0
...
		

Crossrefs

Cf. A364054, A366470, A366477 (records).

Programs

  • Mathematica
    nn = 2^20;
      c[] := False; m[] := 0; a[1] = j = 1; c[0] = c[1] = True;
      Monitor[Do[p = Prime[n - 1]; r = Mod[j, p];
        While[Set[k, p m[p] + r ]; c[k], m[p]++];
        Set[{a[n], b[n], c[k], j}, {k, m[p], True, k}], {n, 2, nn}], n];
    Array[b, nn-1, 2] (* Michael De Vlieger, Oct 26 2023 *)
  • Python
    from itertools import count, islice
    from sympy import nextprime
    def A366475_gen(): # generator of terms
        a, aset, p = 1, {0,1}, 1
        while True:
            p = nextprime(p)
            b = a%p
            for i in count(0):
                if b not in aset:
                    aset.add(b)
                    a = b
                    break
                b += p
            yield i
    A366475_list = list(islice(A366475_gen(),30)) # Chai Wah Wu, Oct 27 2023

A368384 Records in A364054.

Original entry on oeis.org

1, 3, 6, 11, 15, 19, 38, 61, 63, 67, 71, 77, 83, 85, 164, 170, 174, 277, 384, 385, 389, 393, 399, 401, 407, 413, 417, 425, 826, 848, 1279, 1285, 1291, 1301, 1325, 1333, 1341, 1367, 1401, 1431, 1443, 1455, 1463, 1811, 1981, 1987, 2996, 3054, 3106, 3154, 3200, 3226, 3238, 3266, 3278, 4390, 4402, 4916, 7293, 7299, 7533, 7577
Offset: 1

Views

Author

N. J. A. Sloane, Mar 05 2024

Keywords

Crossrefs

Programs

  • Mathematica
    nn = 2^20; c[] := False; m[] := 0; s = 0; a[1] = j = 1;
    c[0] = c[1] = True;
    {1}~Join~Reap[Monitor[Do[p = Prime[n - 1]; r = Mod[j, p];
         While[Set[k, p  m[p] + r]; c[k], m[p]++];
         Set[{c[k], j}, {True, k}];
    If[k > s, s = k; Sow[s]], {n, 2, nn}], n]][[-1, 1]] (* Michael De Vlieger, Mar 05 2024 *)

A368385 Indices of records in A364054.

Original entry on oeis.org

1, 2, 3, 4, 6, 8, 9, 10, 12, 14, 16, 18, 20, 22, 23, 25, 27, 28, 29, 63, 65, 67, 69, 71, 73, 75, 77, 79, 80, 83, 84, 86, 88, 91, 93, 95, 97, 100, 104, 108, 110, 112, 114, 151, 167, 169, 170, 177, 182, 189, 192, 195, 197, 200, 202, 305, 307, 352, 353, 355, 369, 375, 380, 385, 388, 391, 395, 397, 412, 416, 421, 429, 432
Offset: 1

Views

Author

N. J. A. Sloane, Mar 05 2024

Keywords

Crossrefs

Programs

  • Mathematica
    nn = 2^20; c[] := False; m[] := 0; s = 0; a[1] = j = 1;
    c[0] = c[1] = True;
    {1}~Join~Reap[Monitor[Do[p = Prime[n - 1]; r = Mod[j, p];
         While[Set[k, p  m[p] + r]; c[k], m[p]++];
         Set[{c[k], j}, {True, k}];
    If[k > s, s = k; Sow[n]], {n, 2, nn}], n] ][[-1, 1]] (* Michael De Vlieger, Mar 05 2024 *)

A366911 a(n) = (A364054(n+1) - A364054(n)) / prime(n) (where prime(n) denotes the n-th prime number).

Original entry on oeis.org

1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -3, 2, -2, 1, -1, 1, -1, 2, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1
Offset: 1

Views

Author

Rémy Sigrist, Oct 27 2023

Keywords

Comments

a(n) is the number of steps of size prime(n) in going from A364054(n) to A364054(n+1).

Examples

			a(7) = (A364054(8) - A364054(7)) / prime(7) = (19 - 2) / 17 = 1.
		

Crossrefs

Cf. A160357, A364054, A366912 (partial sums).

Programs

  • Mathematica
    nn = 2^16; c[] := False; m[] := 0; j = 1; c[0] = c[1] = True;
      Monitor[Do[p = Prime[n - 1]; r = Mod[j, p];
        While[Set[k, p m[p] + r ]; c[k], m[p]++];
        Set[{a[n - 1], c[k], j}, {(k - j)/p, True, k}], {n, 2, nn + 1}], n];
    Array[a, nn] (* Michael De Vlieger, Oct 27 2023 *)
  • PARI
    See Links section.
    
  • Python
    from itertools import count, islice
    from sympy import nextprime
    def A366911_gen(): # generator of terms
        a, aset, p = 1, {0,1}, 2
        while True:
            k, b = divmod(a,p)
            for i in count(-k):
                if b not in aset:
                    aset.add(b)
                    a, p = b, nextprime(p)
                    yield i
                    break
                b += p
    A366911_list = list(islice(A366911_gen(),30)) # Chai Wah Wu, Oct 27 2023

A366477 a(n) = smallest k such that A366475(k) >= n, or -1 if no such k exists.

Original entry on oeis.org

2, 3, 29, 28025, 2467754261
Offset: 1

Views

Author

N. J. A. Sloane, Oct 26 2023

Keywords

Crossrefs

Programs

  • Mathematica
    nn = 2^16; c[] := False; m[] := 0; j = 1; c[0] = c[1] = True; q[_] := 0; s = -1;
      Monitor[Do[p = Prime[n - 1]; r = Mod[j, p];
        While[Set[k, p m[p] + r ]; c[k], m[p]++];
        (If[q[#] == 0, Set[q[#], n]]; If[# > s, s = #]) &[ m[p] ];
        Set[{c[k], j}, {True, k}], {n, 2, nn}], n];
    Array[q, s] (* Michael De Vlieger, Oct 27 2023 *)
  • Python
    from itertools import count
    from sympy import nextprime
    def A366477(n):
        a, aset, p = 1, {0,1}, 1
        for i in count(2):
            p = nextprime(p)
            b = a%p
            for j in count(0):
                if b not in aset:
                    aset.add(b)
                    a = b
                    break
                b += p
            if j>=n:
                return i # Chai Wah Wu, Oct 27 2023

Extensions

a(4) = 28025 from Michael De Vlieger, Oct 26 2023, who also reports that 5 does not appear in the first 2^24 terms of A366475.
a(5) from Chai Wah Wu, Oct 28 2023

A366912 Partial sums of A366911: a(1) = 0, and for n > 0, a(n+1) = a(n) + A366911(n).

Original entry on oeis.org

0, 1, 2, 3, 2, 3, 2, 3, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 6, 5, 6, 5, 6, 7, 8, 5, 7, 5, 6, 5, 6, 5, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 8, 6, 7, 8, 9, 8, 9, 8
Offset: 1

Views

Author

Rémy Sigrist, Oct 27 2023

Keywords

Comments

By analogy with A064289, a(n) corresponds to the height of A364054(n) = number of addition steps - number of subtraction steps to produce it.

Examples

			a(5) = A366911(1) + A366911(2) + A366911(3) + A366911(4) = 1 + 1 + 1 - 1 = 2.
		

Crossrefs

Programs

  • Mathematica
    nn = 2^16; c[] := False; m[] := 0; j = 1; s = b[1] = 0;
      c[0] = c[1] = True;
      Monitor[Do[p = Prime[n - 1]; r = Mod[j, p];
        While[Set[k, p m[p] + r ]; c[k], m[p]++]; s += (k - j)/p;
        Set[{a[n - 1], b[n - 1], c[k], j}, {(k - j)/p, s, True, k}],
        {n, 2, nn + 1}], n];
    Array[b, nn] (* Michael De Vlieger, Oct 27 2023 *)
  • PARI
    See Links section.
    
  • Python
    from itertools import count, islice
    from sympy import nextprime
    def A366912_gen(): # generator of terms
        a, aset, p, c = 1, {0,1}, 2, 0
        while True:
            k, b = divmod(a,p)
            for i in count(-k):
                if b not in aset:
                    aset.add(b)
                    a, p = b, nextprime(p)
                    yield c
                    c += i
                    break
    A366912_list = list(islice(A366912_gen(),30)) # Chai Wah Wu, Oct 27 2023

Formula

a(n) = Sum_{k = 1..n-1} A366911(k).

A367290 Lexicographically earliest sequence of distinct positive integers such that for any n > 0, a(n) and a(n+1) are congruent modulo the n-th prime number, and the least value not yet in the sequence appears as soon as possible.

Original entry on oeis.org

1, 5, 2, 17, 3, 69, 4, 310, 6, 558, 7, 193, 8, 869, 9, 2077, 10, 1780, 11, 3562, 12, 961, 13, 6155, 14, 2439, 15, 8255, 16, 6120, 18, 12464, 19, 9472, 20, 11195, 21, 4260, 22, 24070, 23, 16133, 24, 18360, 25, 19528, 26, 27456, 27, 25905, 28, 46395, 29, 6054
Offset: 1

Views

Author

Rémy Sigrist, Nov 12 2023

Keywords

Comments

To build the sequence:
- we start with a(1) = 1, and repeatedly:
- let a(n) be the last known term and v the least value not yet in the sequence,
- if a(n) and v are congruent modulo the n-th prime number then a(n+1) = v,
- otherwise a(n+2) = v and a(n+1) is chosen as small as possible in such a way as to satisfy the required congruences (this is always possible as two consecutive prime numbers are coprime).
This sequence is a variant of A364054, and, by design, is guaranteed to be a permutation of the positive integers (with inverse A367291).

Examples

			The first terms are:
  n   a(n)   a(n) mod prime(n)  a(n+1) mod prime(n)
  --  -----  -----------------  -------------------
   1      1                  1                    1
   2      5                  2                    2
   3      2                  2                    2
   4     17                  3                    3
   5      3                  3                    3
   6     69                  4                    4
   7      4                  4                    4
   8    310                  6                    6
   9      6                  6                    6
  10    558                  7                    7
  11      7                  7                    7
  12    193                  8                    8
  13      8                  8                    8
		

Crossrefs

Cf. A364054, A367288, A367291 (inverse).

Programs

  • PARI
    See Links section.

A368382 a(1) = 1; for n > 1, a(n) is the least positive integer not already in the sequence such that a(n) == a(n-1) (mod A004280(n)).

Original entry on oeis.org

1, 3, 6, 11, 4, 13, 2, 15, 30, 47, 9, 51, 5, 55, 28, 57, 26, 59, 24, 61, 22, 63, 20, 65, 18, 67, 16, 69, 14, 71, 12, 73, 10, 75, 8, 77, 148, 221, 146, 223, 144, 225, 142, 227, 53, 231, 49, 235, 45, 239, 41, 243, 37, 247, 33, 251, 29, 255, 25, 259, 21, 263, 17, 267, 140, 269, 7, 273, 138, 275, 136, 277, 134, 279, 132, 281
Offset: 1

Views

Author

N. J. A. Sloane, Mar 03 2024

Keywords

Comments

Analogous to A364054, but whereas that sequence is based on the sequence of primes (2, 3, 5, 7, 11, ....), the present sequence is based on the sequence 2, 3, 5, 7, 9, 11, 13, 15, ... (2 together with the odd numbers >1, essentially A004280).

Crossrefs

Cf. A004280.
Similar definitions: A005132, A006509, A364054.

Programs

  • Python
    from itertools import count, islice
    def A368382_gen(): # generator of terms
        a, aset, p = 1, {0,1}, 2
        while True:
            yield a
            for b in count(a%p,p):
                if b not in aset:
                    aset.add(b)
                    a, p = b, 3 if p == 2 else p+2
                    break
    A368382_list = list(islice(A368382_gen(),40)) # Chai Wah Wu, Mar 05 2024

A366864 Numbers m such that A366470(m) > A366470(m-1).

Original entry on oeis.org

4, 5, 10, 13, 24, 39, 84, 168, 370, 836, 1998, 4622, 11284, 28151, 53565, 138230, 334125, 659741, 1716635, 3977282, 10430384, 27132843, 71588934, 189472352, 505341104, 1353331592
Offset: 1

Views

Author

Chai Wah Wu, Oct 25 2023

Keywords

Comments

Inspired by N. J. A. Sloane's remark about the graph of A366470 consisting of decreasing segments. Terms mark the beginning of these segments in the graph of A366470. Appears to grow exponentially. Terms seem to be near the values of t_i described in Sloane's sketch at A364054.

Crossrefs

Programs

  • Python
    from itertools import count, islice
    from sympy import nextprime
    def A366864_gen(): # generator of terms
        a, aset, p = 1, {0,1}, 2
        for i in count(3):
            for b in count(a,p):
                if b not in aset:
                    aset.add(b)
                    c = b%(p:=nextprime(p))
                    if c > a:
                        yield i
                    a = c
                    break
    A366864_list = list(islice(A366864_gen(),20))
Showing 1-10 of 13 results. Next