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.

A364054 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 prime(n-1)).

Original entry on oeis.org

1, 3, 6, 11, 4, 15, 2, 19, 38, 61, 32, 63, 26, 67, 24, 71, 18, 77, 16, 83, 12, 85, 164, 81, 170, 73, 174, 277, 384, 57, 283, 29, 160, 23, 162, 13, 315, 158, 321, 154, 327, 148, 329, 138, 331, 134, 333, 122, 345, 118, 347, 114, 353, 112, 363, 106, 369, 100, 371, 94, 375, 92, 385
Offset: 1

Views

Author

Ali Sada, Oct 19 2023

Keywords

Comments

5 is the smallest positive integer missing from the first 1000 terms. Also in the interval a(100) to a(1000) there are no entries less than 100. (From W. Edwin Clark via SeqFan.)
Comments from N. J. A. Sloane, Oct 22 2023 (Start)
It appears that the graph of this sequence is dominated by pairs of diverging lines, as suggested by the sketch (see link). For example, around step n = 4619, a descending line is changing to a descending line around a(4619) = 65, a companion ascending line is coming to an end near a(4594) = 44518, and a strong ascending line is starting up around a(4620) = 88899.
It would be nice to have more terms, in order to get better estimates of the times t_i where these transitions happen, and heights alpha_i, beta_i, gamma_i where line breaks are.
The only well-defined points are the (t_i, alpha_i) where the descending lines end, as can be seen from the b-file, where the end point a(4619) = 65 is well-defined. The other transitions, where an ascending line changes to a descending line, are less obvious. It would be nice to know more.
Can the t_i and alpha_i sequences be traced back to the start of the sequence? Of course the alpha_i sequence is not monotonic, and in particular we do not know at present if some alpha_i is equal to 5.
(End)
a(28149) = 7. - Chai Wah Wu, Oct 22 2023
Comment from N. J. A. Sloane, Mar 05 2024 (Start):
At present there is no OEIS entry for the inverse sequence, since it is not known if 5 appears here.
The initial values of the inverse sequence are
n.....1..2..3..4..5..6....7.....8..9..10..11... . . .
index.1..7..2..5..?..3..28149..81..?...?...4... . . . (End)

Examples

			For n = 2, prime(2-1) = prime(1) = 2; a(1) = 1, so a(1) mod 2 = 1, so a(2) is the least positive integer == 1 (mod 2) that has not yet appeared; 1 has appeared, so a(2) = 3.
For n = 3, prime(3-1) = 3; a(2) mod 3 = 0, so a(3) is the least unused integer == 0 mod 3, which is 6, so a(3) =  6.
For n = 4, prime(4-1) = 5; a(3) mod 5 = 1, and 6 has already been used, so a(4) = 11.
		

Crossrefs

For a(n-1) (mod prime(n-1)) see A366470.
Records: A368384, A368385.
See also A366475, A366477.

Programs

  • Mathematica
    a[1] = 1; a[n_] := a[n] = Module[{p = Prime[n - 1], k = 2, s = Array[a, n - 1]}, While[! FreeQ[s, k] || ! Divisible[k - a[n - 1], p], k++]; k]; Array[a, 100] (* Amiram Eldar, Oct 20 2023 *)
    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], c[k], j}, {k, True, k}], {n, 2, nn}], n];
    Array[a, nn] (* Michael De Vlieger, Oct 26 2023, fast, based on congruence, avoids search *)
  • Python
    from itertools import count, islice
    from sympy import nextprime
    def A364054_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, nextprime(p)
                    break
    A364054_list = list(islice(A364054_gen(),30)) # Chai Wah Wu, Oct 22 2023

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