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.

A380311 Partial sums of A377090.

Original entry on oeis.org

0, 2, 1, 2, 0, 3, -1, -7, -10, -6, 0, -5, -12, -21, -13, -8, -1, 8, 0, -10, -22, -11, 2, 12, 24, 13, 0, -15, -1, 15, 33, 48, 34, 18, 0, 19, 36, 56, 39, 20, -1, 21, 45, 66, 46, 24, 0, 23, 48, 75, 49, 26, 1, -26, 0, 28, 58, 29, -2, -30, -60, -31, 0, 33, -1, -33
Offset: 0

Views

Author

Paolo Xausa, Jan 20 2025

Keywords

Crossrefs

Programs

A383444 First differences of A377090.

Original entry on oeis.org

2, -3, 2, -3, 5, -7, -2, 3, 7, 2, -11, -2, -2, 17, -3, 2, 2, -17, -2, -2, 23, 2, -3, 2, -23, -2, -2, 29, 2, 2, -3, -29, -2, -2, 37, -2, 3, -37, -2, -2, 43, 2, -3, -41, -2, -2, 47, 2, 2, -53, 3, -2, -2, 53, 2, 2, -59, -2, 3, -2, 59, 2, 2, -67, 2, 67, -3, 2, -67, -2, 71, -73, -2, 3, 73, 2, -79, 2, 79, -3, 2, 2, -83, -2, -2, 3, -2, 89
Offset: 0

Views

Author

N. J. A. Sloane, Apr 27 2025

Keywords

Crossrefs

Programs

A383445 Index of n in A377090, or -1 if n does not appear there.

Original entry on oeis.org

0, 3, 1, 5, 9, 15, 10, 16, 14, 17, 23, 21, 24, 22, 28, 31, 29, 36, 30, 35, 37, 43, 41, 47, 42, 48, 54, 49, 55, 61, 56, 62, 67, 63, 68, 66, 71, 75, 80, 76, 81, 79, 82, 89, 91, 88, 90, 92, 99, 93, 98, 100, 105, 111, 106, 112, 110, 113, 124, 122, 125, 123, 126, 128, 121, 127, 133, 138, 134, 139, 137, 147, 150, 148, 146, 149, 153
Offset: 0

Views

Author

N. J. A. Sloane, Apr 30 2025

Keywords

Comments

It is conjectured (see A377090) that every positive integer appears exactly once either here or in A383446.

Crossrefs

A383446 Index of -n in A377090, or -1 if -n does not appear there.

Original entry on oeis.org

0, 2, 4, 8, 6, 11, 7, 12, 18, 13, 19, 25, 20, 26, 32, 27, 33, 38, 34, 39, 44, 40, 45, 51, 46, 52, 50, 53, 59, 57, 60, 58, 65, 69, 64, 70, 74, 72, 78, 73, 77, 83, 86, 84, 87, 85, 95, 97, 94, 96, 101, 104, 102, 107, 103, 108, 114, 109, 115, 118, 116, 119, 117, 120, 129, 132, 130, 136, 131, 135, 140, 143, 141, 144, 142, 145, 156
Offset: 0

Views

Author

N. J. A. Sloane, Apr 30 2025

Keywords

Comments

It is conjectured (see A377090) that every positive integer appears exactly once either here or in A383445.

Crossrefs

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
    

A377092 a(0) = 0, and for any n > 0, a(n) is the least integer (in absolute value) not yet in the sequence such that the absolute difference of a(n-1) and a(n) is a Fibonacci number (A000045); in case of a tie, preference is given to the positive value.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Oct 16 2024

Keywords

Comments

Will every integer appear in the sequence?

Examples

			The first terms are:
   n   a(n)  |a(n)-a(n-1)|
  --- ----- ---------------
   0     0       N/A
   1     1        1
   2    -1        2
   3     2        3
   4     3        1
   5    -2        5
   6    -3        1
   7    -4        1
   8     4        8
   9     5        1
  10     6        1
  11     7        1
  12    -6       13
  13    -5        1
  14    -7        2
The first terms are a(0) = 0, a(1) = 1 and a(2) = -1, clearly the |smallest| unused number so far, which yields |a(2)-a(1)| = 2, a Fibonacci number. - _M. F. Hasler_, Feb 21 2025
		

Crossrefs

Cf. A000045, A377090, A377091, A380320 (first differences), A380321 (partial sums).
Cf. A010056 (characteristic function of the Fibonacci numbers).

Programs

  • Mathematica
    A377092list[nmax_] := Module[{s, a, u = 1, fibQ},
      fibQ[n_] := fibQ[n] = (IntegerQ[Sqrt[# + 4]] || IntegerQ[Sqrt[# - 4]]) & [5*n^2];
      s[_] := False; s[0] = True;
      NestList[(While[s[u] && s[-u], u++]; a = u; While[s[a] || !fibQ[Abs[# - a]], a = Boole[a < 0] - a]; s[a] = True; a) &, 0,nmax]];
    A377092list[100] (* Paolo Xausa, Apr 19 2025 *)
  • PARI
    \\ See Links section.
    
  • PARI
    A377092_upto(N, U=[-1])={vector(N, n, if(n>1, for(k=U[1]+1,oo, A010056(k-N) && !setsearch(U, k) && [N=k, break]), N=0); U=setunion(U,[N]); while(#U>1&&U[1]+1==U[2],U=U[^1]); N)} \\ M. F. Hasler, Feb 21 2025
    
  • Python
    def A377092(n):
        if not getattr(A := A377092, 'N', 0):  A.N = 1; A.terms = [0]
        while len(A.terms) <= n:
            while (k := A.N) in A.terms: A.N = (k<0)-k
            while not A010056(abs(k - A.terms[-1])) or k in A.terms: k = (k<0)-k
            A.terms.append(k)
        return A.terms[n] # M. F. Hasler, Feb 10 2025

A377114 a(n) = coefficient of sqrt(2) in the expansion of (3 + sqrt(2) + sqrt(3))^n.

Original entry on oeis.org

0, 1, 6, 38, 240, 1504, 9360, 57968, 357888, 2205376, 13574784, 83503232, 513469440, 3156723712, 19404782592, 119276106752, 733133340672, 4506134745088, 27696241336320, 170229576458240, 1046279833190400, 6430725296226304, 39524980495024128
Offset: 0

Views

Author

Clark Kimberling, Oct 21 2024

Keywords

Comments

Conjecture: every prime divides a(n) for infinitely many n, and if K(p) = (k(1), k(2),...) is the maximal subsequence of indices n such that p divides a(n), then the difference sequence of K(p) is eventually periodic; indeed, K(p) is purely periodic for the first 4 primes, with respective period lengths 1,8,10,7 and these periods:
p = 2: (2)
p = 3: (4, 2, 6, 6, 1, 1, 3, 1)
p = 5: (12, 3, 9, 6, 6, 2, 7, 3, 10, 2)
p = 7: (9, 15, 3, 18, 3, 15, 9)
See A377109 for a guide to related sequences.

Examples

			(3 + sqrt(2) + sqrt(3))^3 = 14 + 6*sqrt(2) + 6*sqrt(3) + 2*sqrt(6), so a(3) = 6.
		

Crossrefs

Programs

  • Mathematica
    (* Program 1 generates sequences A377113-A377116. *)
    tbl = Table[Expand[(3 + Sqrt[2] + Sqrt[3])^n], {n, 0, 24}];
    u = MapApply[{#1/#2, #2} /. {1, #} -> {{1}, {#}} &,
       Map[({#1, #1 /. ^ -> 1} &), Map[(Apply[List, #1] &), tbl]]];
    {s1,s2,s3,s4}=Transpose[(PadRight[#1,4]&)/@Last/@u][[1;;4]];
    s2  (* Peter J. C. Moses, Oct 16 2024 *)
    (* Program 2 generates this sequence. *)
    LinearRecurrence[{12, -44, 48, 8}, {0, 1, 6, 38}, 25]

Formula

a(n) = 12*a(n-1) - 44*a(n-2) + 48*a(n-3) + 8*a(n-4), with a(0)=0, a(1)=1, a(3)=6, a(4)=38.
G.f.: x*(-1 + 6*x - 10*x^2)/(-1 + 12*x - 44*x^2 + 48*x^3 + 8*x^4).

A377115 a(n) = coefficient of sqrt(3) in the expansion of (3 + sqrt(2) + sqrt(3))^n.

Original entry on oeis.org

0, 1, 6, 36, 216, 1304, 7920, 48320, 295680, 1812672, 11124864, 68320000, 419719680, 2579051008, 15849305088, 97406521344, 598661038080, 3679444570112, 22614556631040, 138994100486144, 854291341737984, 5250689954316288, 32272093691707392, 198352703517884416
Offset: 0

Views

Author

Clark Kimberling, Oct 21 2024

Keywords

Comments

Conjecture: every prime divides a(n) for infinitely many n, and if K(p) = (k(1), k(2),...) is the maximal subsequence of indices n such that p divides a(n), then the difference sequence of K(p) is eventually periodic; indeed, K(p) is purely periodic for the first 4 primes, with respective period lengths 4,8,10,10 and these periods:
p = 2: (2, 1, 1, 2)
p = 3: (6, 1, 1, 3, 1, 4, 2, 6)
p = 5: (6, 2, 7, 3, 10, 2, 12, 3, 9, 6)
p = 7: (14, 4, 4, 2, 12, 1, 11, 5, 1, 18)
See A377109 for a guide to related sequences.

Examples

			(3 + sqrt(2) + sqrt(3))^3 = 14 + 6*sqrt(2) + 6*sqrt(3) + 2*sqrt(6), so a(3) = 6.
		

Crossrefs

Programs

  • Mathematica
    (* Program 1 generates sequences A377113-A377116. *)
    tbl = Table[Expand[(3 + Sqrt[2] + Sqrt[3])^n], {n, 0, 24}];
    u = MapApply[{#1/#2, #2} /. {1, #} -> {{1}, {#}} &,
       Map[({#1, #1 /. ^ -> 1} &), Map[(Apply[List, #1] &), tbl]]];
    {s1,s2,s3,s4}=Transpose[(PadRight[#1,4]&)/@Last/@u][[1;;4]];
    s3  (* Peter J. C. Moses, Oct 16 2024 *)
    (* Program 2 generates this sequence. *)
    LinearRecurrence[{12, -44, 48, 8}, {0, 1, 6, 36}, 25]

Formula

a(n) = 12*a(n-1) - 44*a(n-2) + 48*a(n-3) + 8*a(n-4), with a(0)=0, a(1)=1, a(3)=6, a(4)=36.
G.f.: x*(-1 + 6*x - 8*x^2)/(-1 + 12*x - 44*x^2 + 48*x^3 + 8*x^4).
Showing 1-8 of 8 results.