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 12 results. Next

A245340 Smallest m such that A125717(m) = n, or -1 if n never appears.

Original entry on oeis.org

0, 1, 4, 2, 8, 21, 3, 5, 18, 16, 14, 12, 10, 6, 1518, 32, 58, 30, 184, 28, 7, 26, 9, 11, 13, 15, 17, 19, 102, 51, 100, 49, 98, 47, 96, 45, 94, 43, 92, 41, 90, 39, 88, 37, 86, 35, 84, 20, 24, 22, 505, 81, 2510, 79, 166, 77, 296, 75, 501, 73, 162, 71, 498, 69
Offset: 0

Views

Author

Reinhard Zumkeller, Jul 21 2014

Keywords

Comments

Conjecture: a(n) is never -1.

Crossrefs

For RECORDS see A370956 and A370959.

Programs

  • Haskell
    import Data.IntMap (singleton, member, (!), insert)
    a245340 n = a245340_list !! n
    a245340_list = 0 : f [1..] [1..] 0 (singleton 0 0) where
       f us'@(u:us) vs'@(v:vs) w m
         | u `member` m = (m ! u) : f us vs' w m
         | otherwise    = g (reverse[w-v,w-2*v..1] ++ [w+v,w+2*v..]) where
         g (x:xs) = if x `member` m then g xs else f us' vs x $ insert x v m
    
  • Python
    from itertools import count
    def A245340(n):
        a, aset = 0, set()
        for m in count(1):
            if a==n: return m-1
            aset.add(a)
            a = next(a for a in count(a%m,m) if a not in aset) # Chai Wah Wu, Mar 13 2024

A245394 Record values in A125717.

Original entry on oeis.org

0, 1, 3, 6, 7, 13, 20, 22, 23, 24, 25, 26, 27, 47, 49, 72, 73, 75, 77, 79, 81, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 134, 189, 245, 253, 298, 341, 448, 454, 460, 525, 540, 546, 552, 558, 561, 734, 759, 769, 883, 892, 893, 903, 909, 915, 921, 927
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 21 2014

Keywords

Comments

a(n) = A125717(A245395(n)) and A125717(m) < a(n) for m < A245395(n).

Crossrefs

Programs

  • Haskell
    a245394 n = a245394_list !! (n-1)
    (a245394_list, a245395_list) =  unzip $ f [0..] a125717_list (-1) where
       f (x:xs) (y:ys) r = if y > r then (y,x) : f xs ys y else f xs ys r

A245395 Where record values occur in A125717.

Original entry on oeis.org

0, 1, 2, 3, 5, 6, 7, 9, 11, 13, 15, 17, 19, 20, 22, 23, 25, 27, 29, 31, 33, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 55, 56, 60, 83, 106, 107, 111, 115, 148, 157, 161, 165, 169, 172, 173, 186, 192, 250, 256, 258, 264, 268, 272, 276, 280, 284, 287, 289
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 21 2014

Keywords

Comments

A245394(n) = A125717(a(n)) and A125717(m) < A245394(n) for m < a(n).

Crossrefs

Programs

  • Haskell
    a245395 n = a245395_list !! (n-1) -- a245395_list is defined in A245394.

A370957 First differences of A125717.

Original entry on oeis.org

1, 2, 3, -4, 5, 6, 7, -16, 18, -10, 11, -12, 13, -14, 15, -16, 17, -18, 19, 20, -42, 44, 23, -24, 25, -52, 54, -56, 58, -60, 62, -64, 66, 34, -70, 72, -74, 76, -78, 80, -82, 84, -86, 88, -90, 92, -94, 96, -98, 100, -102, 104, -53, 54, 55, 56, -171, -58, 177, 60, -183, 62, -63, 128, -130, 132, -134, 136, -138, 140, -142
Offset: 1

Views

Author

N. J. A. Sloane, Mar 15 2024

Keywords

Comments

In other words, a(n) = A125717(n)-A125717(n-1).

Crossrefs

A370958 Normalized first differences of A125717.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Mar 15 2024

Keywords

Crossrefs

Formula

a(n) = A370957(n)/n.

A372057 After A125717(n) has been found, a(n) is the smallest missing number.

Original entry on oeis.org

1, 2, 2, 2, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14
Offset: 0

Views

Author

N. J. A. Sloane, Apr 30 2024

Keywords

Crossrefs

Cf. A125717.
A370959 lists the distinct terms in order, and the first differences of A370956 specify the lengths of the runs of identical terms.

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

A099506 a(1)=1; for n > 1, a(n)=smallest m>0 that has not appeared so far in the sequence such that m+a(n-1) is a multiple of n.

Original entry on oeis.org

1, 3, 6, 2, 8, 4, 10, 14, 13, 7, 15, 9, 17, 11, 19, 29, 5, 31, 26, 34, 50, 16, 30, 18, 32, 20, 61, 23, 35, 25, 37, 27, 39, 63, 42, 66, 45, 69, 48, 72, 51, 33, 53, 79, 56, 36, 58, 38, 60, 40, 62, 94, 12, 96, 124, 44, 70, 46, 131, 49, 73, 113, 76, 52, 78, 54, 80, 192, 84, 126, 87
Offset: 1

Views

Author

Mark Hudson (mrmarkhudson(AT)hotmail.com), Oct 20 2004

Keywords

Examples

			a(1)=1 by definition.
a(2)=3 because then a(2)+a(1)=3+1=4 which is a multiple of 2. a(2) cannot be 1 (which would lead to a sum of 2) because this has already appeared.
Likewise, a(3)=6 so that a(3)+a(2)=6+3=9 which is a multiple of 3.
a(4)=2 so that a(4)+a(3)=2+6=8 and so on.
		

Crossrefs

Cf. A099507 for positions of occurrences of integers in this sequence.
Cf. A125717.

Programs

  • MATLAB
    N = 100;
    M = 10*N;  % find a(1) to a(N) or until a(n) > M
    B = zeros(1,M);
    A = zeros(1,N);
    mmin = 2;
    A(1) = 1;
    B(1) = 1;
    for n = 2:N
      for m = mmin:M
        if mmin == m && B(m) == 1
           mmin = mmin+1;
        elseif B(m) == 0 && rem(m + A(n-1),n) == 0
          A(n) = m;
          B(m) = 1;
          if m == mmin
             mmin = mmin + 1;
          end;
          break
        end;
      end;
      if A(n) == 0
         break
      end
    end;
    if A(n) == 0
      A(1:n-1)
    else
      A
    end; % Robert Israel, Jun 17 2015
  • PARI
    v=[1];n=1;while(n<100,s=n+v[#v];if(!(s%(#v+1)||vecsearch(vecsort(v),n)),v=concat(v,n);n=0);n++);v \\ Derek Orr, Jun 16 2015
    

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

Original entry on oeis.org

0, 1, 5, 2, 18, 3, 39, 4, 60, 6, 106, 7, 151, 8, 204, 9, 265, 10, 334, 11, 411, 12, 496, 13, 589, 14, 690, 15, 799, 16, 916, 17, 1009, 19, 1175, 20, 1316, 21, 1465, 22, 1622, 23, 1787, 24, 1960, 25, 2141, 26, 2330, 27, 2527, 28, 2732, 29, 2945, 30, 3166, 31
Offset: 0

Views

Author

Rémy Sigrist, Nov 12 2023

Keywords

Comments

To build the sequence:
- we start with a(0) = 0, 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 n+1 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 n+1 and n+2 are coprime).
This construction is similar to that of A352713.
This sequence is a variant of A125717 and, by design, is guaranteed to be a permutation of the nonnegative integers (with inverse A367289).

Examples

			The first terms are:
  n   a(n)  a(n-1) mod n  a(n) mod n
  --  ----  ------------  ----------
   0     0  N/A           N/A
   1     1             0           0
   2     5             1           1
   3     2             2           2
   4    18             2           2
   5     3             3           3
   6    39             3           3
   7     4             4           4
   8    60             4           4
   9     6             6           6
  10   106             6           6
  11     7             7           7
  12   151             7           7
  13     8             8           8
		

Crossrefs

Programs

  • PARI
    See Links section.

A370956 Record high values in A245340.

Original entry on oeis.org

0, 1, 4, 8, 21, 1518, 2510, 4100, 11181, 18414, 30374, 50121, 82924, 136341, 611212, 4477981, 7351356, 12086260, 19861634, 32648059, 53646155, 144857355, 238062163, 643132294, 1736990151, 4691130396, 7709412048
Offset: 1

Views

Author

N. J. A. Sloane, Mar 13 2024

Keywords

Comments

These numbers take a record number of steps to appear in A125717.

Crossrefs

See A370959 for the indices of these records in A245340.

Programs

  • Python
    from itertools import count, islice
    def A370956_gen(): # generator of terms
        a, aset, b, c = 0, set(), 0, -1
        for n in count(1):
            aset.add(a)
            if a==b:
                if n-1>c:
                    c = n-1
                    yield c
                while b in aset:
                    b += 1
            a = next(a for a in count(a%n,n) if a not in aset)
    A370956_list = list(islice(A370956_gen(),20)) # Chai Wah Wu, Mar 28 2024

Extensions

a(17)-a(24) from Michael S. Branicky, Mar 28 2024
a(25)-a(27) from Chai Wah Wu, Mar 28 2024
Showing 1-10 of 12 results. Next