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.

User: Thomas Anton

Thomas Anton's wiki page.

Thomas Anton has authored 6 sequences.

A377459 Square array T(n,k) read by ascending antidiagonals: number of steps for a certain Euclidean-style algorithm (see below) to find the GCD of n and k.

Original entry on oeis.org

0, 1, 2, 3, 0, 3, 4, 2, 4, 5, 6, 1, 0, 2, 6, 7, 5, 4, 5, 4, 8, 9, 3, 3, 0, 6, 3, 9, 10, 5, 1, 5, 7, 2, 7, 11, 12, 4, 6, 2, 0, 4, 6, 5, 12, 13, 8, 7, 5, 7, 8, 7, 5, 7, 14, 15, 6, 3, 1, 6, 0, 6, 2, 3, 6, 15, 16, 8, 7, 8, 4, 8, 10, 8, 7, 8, 10, 17, 18, 7, 6, 5, 6, 4, 0, 5, 9, 4, 9, 8, 18
Offset: 1

Author

Thomas Anton, Jan 03 2025

Keywords

Comments

The algorithm begins with the list n,k. Each step appends to the list the absolute difference of the last two items on the list. The algorithm terminates when the last two items are equal. These will share the value of the GCD of n and k.

Examples

			For T(5,2), the list of successive absolute differences is as follows and reaches equal values (1,1) after T(5,2) = 5 steps,
    5,2, 3, 1, 2, 1, 1
         \-----------/  steps
The array begins:
  n\k|  1  2  3  4  5  6   7   8  ...
  ---+-------------------------------
   1 |  0, 2, 3, 5, 6, 8,  9, 11, ...
   2 |  1, 0, 4, 2, 4, 3,  7,  5, ...
   3 |  3, 2, 0, 5, 6, 2,  6,  5, ...
   4 |  4, 1, 4, 0, 7, 4,  7,  2, ...
   5 |  6, 5, 3, 5, 0, 8,  6,  8, ...
   6 |  7, 3, 1, 2, 7, 0, 10,  5, ...
   7 |  9, 5, 6, 5, 6, 8,  0, 11, ...
   8 | 10, 4, 7, 1, 4, 4, 10,  0, ...
  ...
		

Crossrefs

Programs

  • Python
    def T(n,k):
        old = n
        new = k
        steps = 0
        while old != new:
            old, new, steps = new, abs(new-old), steps+1
        return steps

Formula

Uniquely determined by the following seven equations:
T(n,n) = 0,
T(n,2n) = 2,
T(2k,k) = 1,
T(n,n+k) = T(n,n-k)+3,
T(k+n,k) = T(k-n,k),
T(n,2n+k) = T(n,k)+3,
T(n+2k,k) = T(n,k)+3.

A345653 Decimal expansion of (sqrt(2) + arcsinh(1))/4.

Original entry on oeis.org

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

Author

Thomas Anton, Jun 21 2021

Keywords

Comments

Maximal value of the average distance from the set of lattice points of any line in the plane, where average distance is the limit of the integral of the distance to the set over a segment of the line centered around a fixed point, divided by the length of the segment, as that length approaches infinity, achieved precisely by lines x = z + 1/2 and y = z + 1/2 for integers z.
The average distance between the center of a unit square to a randomly and uniformly chosen point on its perimeter. - Amiram Eldar, Jun 23 2022

Examples

			0.57389678734815951850857451...
		

Crossrefs

Programs

  • Mathematica
    First[RealDigits[N[(Sqrt[2]+ArcSinh[1])/4,100]]] (* Stefano Spezia, Jun 21 2021 *)
  • PARI
    (sqrt(2) + asinh(1))/4 \\ Michel Marcus, Jun 24 2021

Formula

Equals Integral_{x=0..1/2} 2*sqrt(x^2+1/4) dx.
Equals (1/2) * A103711. - Amiram Eldar, Jun 23 2022

A323186 a(0) = 0, a'(0) = 0, a''(0) = 1, a''(1) = -1, a(n) = a(n-1) + a'(n), a'(n) = a'(n-1) + a''(n), a''(n) = -a''(n-1) if a(n-2) = 0, or else a''(n-1).

Original entry on oeis.org

0, -1, -1, 0, 2, 3, 3, 2, 0, -3, -5, -6, -6, -5, -3, 0, 4, 7, 9, 10, 10, 9, 7, 4, 0, -5, -9, -12, -14, -15, -15, -14, -12, -9, -5, 0, 6, 11, 15, 18, 20, 21, 21, 20, 18, 15, 11, 6, 0, -7, -13, -18, -22, -25, -27, -28, -28, -27, -25, -22, -18, -13, -7, 0, 8, 15, 21, 26, 30, 33, 35, 36, 36, 35, 33, 30, 26, 21, 15, 8, 0, -9, -17, -24, -30, -35, -39, -42, -44, -45, -45, -44, -42, -39, -35, -30, -24, -17, -9, 0
Offset: 0

Author

Thomas Anton, Jan 06 2019

Keywords

Comments

This sequence might be called the "Bad Driver's Sequence" as it fully "accelerates" or "decelerates" when it changes side of its "speed limit".

Examples

			a''(0) = 1, a'(0) = 0, a(0) = 0.
a''(1) = -1, a'(1) = 0 - 1 = -1, a(1) = 0 - 1 = -1.
a(2-2) = a(0) = 0, so a''(2) = -a''(1) = 1, a'(2) = -1 + 1 = 0, a(2) = -1 + 0 = -1.
		

Crossrefs

Programs

  • Haskell
    a(0) = 0
    a(1) = -1
    a(2) = -1
    a(n) = if a(n-2) == 0 then a(n-1) + a'(n-1) - a''(n-1) else a(n-1) + a'(n-1) + a''(n-1)
    where a'(n) = a(n) - a(n-1)
          a''(n) = a'(n) - a'(n-1)
    
  • Perl
    my @a = (0, -1, -1);
    for my $n (scalar(@a)..1000) {
        if ($a[$n - 2] == 0) {
            $a[$n] = $a[$n - 1] + &as($n - 1) - &ass($n - 1);
        } else {
            $a[$n] = $a[$n - 1] + &as($n - 1) + &ass($n - 1);
        }
        print "$n $a[$n]\n";
    } # for n
    sub as  { my ($n) = @_; return $a[$n]  -  $a[$n - 1]; }
    sub ass { my ($n) = @_; return &as($n) - &as($n - 1); }
    # Georg Fischer, Feb 14 2019

Formula

a'(n) = A053615(n)*(-1)^ceiling((sqrt(4n+1)-1)/2).
a''(n) = (-1)^ceiling(sqrt(n)).
a''(n) changes sign at A002522, a(n) = 0 at A005563.
a(n) has local extrema (with a'(n) = 0) at the oblong numbers A002378 with the value of A000217(n)*(-1)^n, the magnitude of which is the corresponding triangular number, as such |a(n)| <= n/2.

Extensions

a(44) corrected [18, not -18] by Tom Duff, Feb 14 2019

A322480 Irregular triangular array read by rows: T(n,k), n>=1, is the number of ordered factorizations corresponding to each unordered factorization, indexed by k.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 2, 2, 3, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 1, 1, 2, 2, 3, 1, 1, 2, 2, 3, 1, 2, 1, 2, 1, 1, 2, 2, 2, 3, 6, 4, 1, 1, 1, 2, 1, 2, 1, 1, 2, 2, 3, 1, 1, 2, 2, 2, 6, 1, 1, 2, 2, 3, 3, 4, 1, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 3, 1, 6, 3, 6, 1, 1, 2, 1, 2, 1, 2, 2, 3, 2, 6, 4, 1, 1, 2, 2, 2, 6, 1, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 1, 1, 2, 2, 2, 3, 2, 6, 6, 4, 12, 5
Offset: 1

Author

Thomas Anton, Dec 09 2018

Keywords

Comments

The method of indexing the unordered factorizations of n in this array is as follows: take all unordered factorizations of n and write them with their factors in nonincreasing order (e.g., 2*4*5*3 becomes 5*4*3*2), and order these reverse-lexicographically (e.g., for 12: 12, 6*2, 4*3, 3*2*2), then assign the index k to the k-th factorization in this ordering.
For a sequence f with Dirichlet inverse f^(-1), f^(-1)(n) is the sum over all multisets M of integers > 1 with product n, of the product of the terms f(m) with indices m in M (counted with multiplicity) multiplied by T(n,k)*(-1)^c/f(1)^(c+1) where c = |M| and T(n,k) corresponds to M.
The multiset of entries in the n-th row is determined by the prime signature of n.
For the p^j-th row with p a prime, the entries give the number of compositions of j corresponding to each partition of j, indexed by k in an analogous manner, given by the j-th row of A048996.

Examples

			  1;
  1;
  1;
  1, 1;
  1;
  1, 2;
  1;
  1, 2, 1;
  1, 1;
  1, 2;
  1;
  1, 2, 2, 3;
  etc.
The 12th row is 1,2,2,3, because 12 can be factored as 12, 6*2, 3*4 or 3*2*2 with respective sets of ordered factorizations {12}, {6*2, 2*6}, {4*3, 3*4} and {3*2*2, 2*3*2, 2*2*3}, with respective cardinalities 1, 2, 2 and 3.
		

Crossrefs

Cf. A048996, A002033 (row sums), A212171, A251683, A001055 (row lengths).

A320890 a(1) = 11. For all subsequent terms a(n), take a(n-1) and substitute for the k-th digit the binary number of times that digit has appeared in a(n-1), reading left to right from the 1st to k-th digit.

Original entry on oeis.org

11, 110, 1101, 110111, 110111100101, 11011110010111010111111001000, 1101111001011101011111100100010011010101101111011001101111011111000010001111100010010100110101011
Offset: 1

Author

Thomas Anton, Oct 23 2018

Keywords

Comments

Each term is an initial segment of all of its successors.
There are always more 1's than 0's in a term.
The proportion of 0's or 1's in the n-th term approaches 1/2 as n approaches infinity.
Starting with any binary integer apart from 0 or 1 and applying the same process to yield a sequence s(n), we have that, for a sufficiently large x, a(n) is always an initial segment of s(n+x). The constancy and uniqueness of the limiting behavior of initial segments in base 2 is unique among all bases, unless the tally system is considered as a degenerate case.

Examples

			a(1) = 11
The first 1 is replaced with 1, and the second 1 is replaced with 10 (two), so a(2) = 110 (1|10)
The first 1 is replaced with 1, the second 1 with 10, and the first 0 with 1, so a(3) = 1101 (1|10|1)
The first 1 is replaced with 1, the second 1 with 10, the first 0 with 1, and the third 1 with 11 (three), so a(4) = 110111 (1|10|1|11)
The first 1 is replaced with 1, the second 1 with 10, the first 0 with 1, the third 1 with 11, the fourth 1 with 100, and the fifth 1 with 101, so a(5) = 110111100101 (1|10|1|11|100|101)
The first 1 is replaced with 1, the second 1 with 10, the first 0 with 1, the third 1 with 11, the fourth 1 with 100, the fifth 1 with 101, the sixth 1 with 110, the second 0 with 10, the third 0 with 11, the seventh 1 with 111, the fourth 0 with 100, and the eighth 1 with 1000, so a(6) = 11011110010111010111111001000 (1|10|1|11|100|101|110|10|11|111|100|1000)
		

Crossrefs

Programs

  • Mathematica
    FromDigits /@ Nest[Append[#, Flatten[IntegerDigits[#, 2] & /@ Table[Count[#, Last@ #] &@ #[[1 ;; k]], {k, Length@ #}]] &[#[[-1]] ] ] &, {{1, 1}}, 6] (* Michael De Vlieger, Oct 23 2018 *)
  • PARI
    eva(n) = subst(Pol(n), x, 10)
    replace(v) = my(w=[], zeros=0, ones=0); for(k=1, #v, if(v[k]==0, zeros++; w=concat(w, binary(zeros))); if(v[k]==1, ones++; w=concat(w, binary(ones)))); w
    terms(n) = my(v=[1, 1], i=0); while(i < n, print1(eva(v), ", "); i++; v=replace(v))
    /* Print initial 7 terms as follows: */
    terms(7) \\ Felix Fröhlich, Oct 23 2018
    
  • Python
    A320890_list = [11]
    while len(A320890_list)<10:
        a0,a1,s = 0,0,''
        for d in str(A320890_list[-1]):
            if d == '0':
                a0 += 1
                s += bin(a0)[2:]
            else:
                a1 += 1
                s += bin(a1)[2:]
        A320890_list.append(int(s)) # Chai Wah Wu, Nov 30 2018

A320838 a(0) = 0, a(n) is the number of x such that a(x) = a(n-1) and there exists no y such that x < y < n and a(y) > a(n-1).

Original entry on oeis.org

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

Author

Thomas Anton, Oct 21 2018

Keywords

Comments

After the n-th occurrence (with n <= m) of m after a number larger than n comes the segment of the sequence from the first appearance of n to the first appearance of m.
The first appearance of n in this sequence is given by A002104(n).

Examples

			Start with a(0) = 0.
No larger number has occurred yet, and the number of 0's since the start of the sequence is 1, so a(1) = 1.
No larger number has occurred yet, and the number of 1's since the start of the sequence is 1, so a(2) = 1.
Still no larger number has occurred, and the number of 1's since the start of the sequence is 2, so a(3) = 2.
No larger number has occurred yet, and the number of 2's since the start of the sequence is 1, so a(4) = 1.
The number of 1's that have occurred since the last appearance of a larger number is 1, so a(5) = 1.
Etc.
		

Crossrefs

Cf. A002104.

Programs

  • Mathematica
    a[0] = 0; a[n_] := a[n] = Count[Range[0, n-1], x_ /; a[x] == a[n - 1] && ! AnyTrue[ Range[x+1, n-1], a[#] > a[n-1] &]]; a /@ Range[0, 89] (* Giovanni Resta, Oct 22 2018 *)
  • PARI
    lista(nn) = {va = vector(nn); va[1] = 0; for (n=2, nn, nb = 0; forstep (k=n-1, 1, -1, if (va[k] == va[n-1], nb++); if (va[k] > va[n-1], break);); va[n] = nb;); va;} \\ Michel Marcus, Oct 22 2018

Formula

Let s(n) be the first time n appears in the sequence, then s(n) = Sum_{k=0...n-1} (s(n-1)-s(k)+1).