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

A382716 a(n) = n - A382715(n).

Original entry on oeis.org

1, 1, 4, 1, 1, 9, 1, 1, -4, 1, 1, 1, 25, -4, 1, 1, 1, 36, -1, -1, -4, -1, 4, -4, 49, 4, 1, 1, -1, -1, -1, 64, 4, 1, 1, 1, 1, 1, 1, 1, 1, 81, 1, 1, 1, 1, 1, 1, 1, 1, 100, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 121, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 144, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -9, 4, 1, 1, 1, 1, 1, 1, 1, 196, -1, -4, -1, -1, 4, -9
Offset: 1

Views

Author

N. J. A. Sloane, Apr 09 2025

Keywords

Comments

Assuming that every integer appears in A377901, a(n) gives an indication of how difficult it was for the positive integer n to appear there.
(The definition of A377091 implies that |a(n)| is a square.)

Crossrefs

For RECORDS, see A382717, A382718, A379789.

A377091 a(0) = 0; thereafter a(n) is the least integer (in absolute value) not yet in the sequence such that the absolute difference between a(n-1) and a(n) is a square; in case of a tie, preference is given to the positive value.

Original entry on oeis.org

0, 1, 2, -2, -1, 3, 4, 5, -4, -3, 6, 7, 8, -8, -7, -6, -5, -9, -10, -11, -12, 13, 9, 10, 11, 12, -13, -14, -15, -16, -17, -18, 18, 14, 15, 16, 17, -19, -20, -21, -22, -23, -24, 25, 21, 20, 19, 23, 22, 26, 27, 28, 24, -25, -26, -27, -28, -29, -30, -31, -32, 32
Offset: 0

Views

Author

Rémy Sigrist, Oct 16 2024

Keywords

Comments

Conjecture 1: Every integer (positive or negative) appears in this sequence.
Conjecture 2: For n > 16, |a(n)| is within sqrt(n/2) of floor(n/2). See A379071. - N. J. A. Sloane, Dec 29 2024 [Corrected by Paolo Xausa, Jan 21 2025]
Conjecture 3: lim sup ||a(n)| - floor(n/2)|/sqrt(n) = 1/2. (See link.) - N. J. A. Sloane and Paolo Xausa, Feb 03 2025
Conjecture 4: After a(n) has been found, the sequence contains all numbers in the range [0,f(n)], where lim sup f(n) = (n-sqrt(n))/2. There is a corresponding conjecture for the negative terms. See A379067. - N. J. A. Sloane and Paolo Xausa, Feb 13 2025

Examples

			The initial terms are:
  n   a(n)  |a(n)-a(n-1)|
  --  ----  -------------
   0     0  N/A
   1     1  1^2
   2     2  1^2
   3    -2  2^2
   4    -1  1^2
   5     3  2^2
   6     4  1^2
   7     5  1^2
   8    -4  3^2
   9    -3  1^2
  10     6  3^2
  11     7  1^2
  12     8  1^2
  13    -8  4^2
  14    -7  1^2
		

Crossrefs

This sequence is a variant of A277616 allowing negative values.
A large number of sequences have been derived from the present sequence in the hope (so far unfulfilled) of finding a formula or recurrence: see A379057-A379078, A379786-A379798, A379802, A379803, A379804, A379880, A380223, A380224, A380225, A382715-A382718.
First differences are A379061 (certainly the most relevant derived sequence). - M. F. Hasler, Feb 08 2025
"Lexicographically earliest" sequences for which there is a proof that every number that could appear does appear: A064413, A098550, A109812, A121216, A347113, etc. - N. J. A. Sloane, Feb 08 2025

Programs

  • JavaScript
    A377091 = [0]; A377091.least_unused = 1;
    function a(n){
      for(let i = A377091.length-1; i < n; ++i) {
        let k = A377091.least_unused;
        while(!Number.isInteger(Math.sqrt(Math.abs(A377091[i] - k)))
              || A377091.indexOf(k) > 0) k = (k<0)-k;
        A377091.push(k);
        if (k == A377091.least_unused) {
          do k = (k<0)-k; while ( A377091.indexOf( k ) > 0 );
          A377091.least_unused = k;
      } };
      return A377091[n];
    } // M. F. Hasler, Jan 26 2025
  • Maple
    h := proc(b, a, i) option remember; ifelse(issqr(abs(a[-1] - i)) and not is(i in a), ifelse(b < nops(a) + 1, a, h(b, [op(a), i], 1)), h(b, a, ifelse(i < 0, 1 - i, -i))) end:
    a_list := length -> h(length, [0], 1): a_list(62);  # Peter Luschny, Jan 20 2025
  • Mathematica
    A377091list[nmax_] := Module[{s, a, u = 1}, s[_] := False; s[0] = True; NestList[(While[s[u] && s[-u], u++]; a = u; While[s[a] || !IntegerQ[Sqrt[Abs[# - a]]], a = Boole[a < 0] - a]; s[a] = True; a) &, 0,nmax]];
    A377091list[100] (* Paolo Xausa, Mar 18 2025 *)
  • PARI
    \\ See Links section.
    
  • PARI
    A377091_upto(n,S=[])={vector(n+1, k, S=setunion(S, [n=if(k>1, k=1; while(setsearch(S,k) || !issquare(abs(n-k)), k=(k<0)-k); k)]); n)} \\ M. F. Hasler, Jan 18 2025
    
  • Python
    from math import isqrt
    from itertools import count, islice
    def cond(n): return isqrt(n)**2 == n
    def agen(): # generator of terms
        an, aset, m = 0, {0}, 1
        for n in count(0):
            yield an
            an = next(s for k in count(m) for s in [k, -k] if s not in aset and cond(abs(an-s)))
            aset.add(an)
            while m in aset and -m in aset: m += 1
    print(list(islice(agen(), 62))) # Michael S. Branicky, Dec 25 2024
    
  • Python
    from math import sqrt
    def a_list(b: int, a: list[int] = [0], i: int = 1) -> list[int]:
        if sqrt(abs(a[-1] - i)).is_integer() and not (i in a):
            a += [i]
            if b < len(a):
                return a
            else:
                return a_list(b, a)
        else:
            return a_list(b, a, int(i < 0) - i)
    print(a_list(40))  # Peter Luschny, Jan 20 2025
    
  • Python
    class A377091: # A377091(n) gives a(n)
        terms = [0]; N = 1 # next candidate
        def _new_(A, n): A.extend(A, n-len(A.terms)+1); return A.terms[n]
        def extend(A, n): any((k:=A.N) in A.terms and setattr(A, 'N', k:=(k<0)-k) or
            A.terms.append(next(k for _ in range(9**9) if (abs(A.terms[-1]-k)**.5)
           .is_integer() and k not in A.terms or not(k:=(k<0)-k))) for _ in range(n))
    # M. F. Hasler, Feb 08 2025
    

A379789 Sequence Sb of the eight sequences defining the blocks of terms in A377091.

Original entry on oeis.org

1, 3, 6, 13, 18, 25, 32, 42, 51, 62, 73, 98, 113, 128, 145, 162, 181, 201, 222, 243, 266, 290, 337, 366, 394, 419, 452, 479, 478, 516, 544, 546, 578, 613, 612, 651, 684, 721, 720, 761, 763, 804, 801, 842, 883, 926, 970, 1057, 1058, 1105, 1156, 1153, 1205, 1202, 1251, 1302, 1353, 1457, 1459, 1513, 1568, 1625, 1683, 1742, 1801
Offset: 1

Views

Author

N. J. A. Sloane, Jan 17 2025

Keywords

Comments

See the comments in A379788 (Sequence Sa) for further information.
See also A382715-A382718.

Crossrefs

Programs

A382718 Numbers missing from A382717.

Original entry on oeis.org

4, 13, 25, 45, 53, 62, 72, 81, 84, 115, 118, 143, 145, 152, 161, 164, 170, 173, 182, 187, 192, 197, 214, 223, 228, 234, 248, 265, 272, 275, 283, 294, 302, 307, 312, 317, 319, 323, 329, 332, 341, 344, 350, 353, 355, 365, 375, 379, 382, 385, 400, 445, 455, 459, 462, 465, 480, 483, 487, 492
Offset: 1

Views

Author

N. J. A. Sloane, Apr 13 2025

Keywords

Crossrefs

Complement of A382717.

A382717 Square roots of record high points in A382716.

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 63, 64, 65, 66, 67, 68, 69, 70, 71, 73, 74, 75, 76, 77, 78, 79, 80, 82, 83, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
Offset: 1

Views

Author

N. J. A. Sloane, Apr 13 2025

Keywords

Comments

The indices of these high points are given in A379789.

Examples

			A382716 begins 1, 1, 4, 1, 1, 9, 1, 1, -4, 1, 1, 1, 25, -4, 1, 1, 1, 36, -1, -1, -4, -1, 4, -4, 49, 4, 1, 1, ..., the record high points are 1, 4, 9, 25, 36, 49, ..., and taking square roots we get 1, 2, 3, 5, 6, 7, ..., which is the present sequence.
		

Crossrefs

Cf. A377091, A382715, A382716, A382718 (the missing numbers), A379789.

Extensions

More than the usual number of terms are shown, to help distinguish this from similar sequences.
Showing 1-5 of 5 results.