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 10 results.

A119632 Lengths of successive runs in A160357, where a run here means a string of alternating terms.

Original entry on oeis.org

1, 1, 3, 1, 11, 1, 4, 10, 1, 4, 28, 1, 10, 24, 1, 8, 1, 2, 1, 1, 4, 1, 9, 4, 1, 2, 36, 1, 12, 4, 1, 2, 1, 3, 28, 1, 10, 52, 1, 18, 1, 32, 1, 12, 15, 38, 1, 14, 32, 1, 12, 1, 44, 1, 16, 1, 148, 1, 50, 7, 22, 1, 8, 3, 4, 1, 2, 70, 1, 24, 1, 114, 1, 42, 1, 200, 1, 68, 6, 1, 2, 13
Offset: 1

Views

Author

N. J. A. Sloane and Allan Wilks, Jun 10 2006

Keywords

Comments

Gives a highly compressed version of A005132.
The encoding of Recamán's sequence a(n) = A005132 using A119632 is easy - A119632 counts runs of alternating i(n)'s, where i(n) = (a(n)-a(n-1))/n = A160357(n).
Note that i(n) is always +1 or -1. Each run ends when i(n) = i(n+1).
Here is pseudo-code to reconstruct Recamán's sequence from A119632, which we will call I(n):
a(0) = 0
n = 1
i = 1
for k = 1..oo {
for j = 1..I(k) {
a(n) = a(n-1) + n*i
n = n+1
i = -i
}
i = -i
}
The gzipped file attached to A119632 represents the first 1470117206801829 terms of A005132. The longest run of alternating i(n)'s (maximal value found so far in A119632) is 232144588914. There are 64094657 runs encoded in the gzipped file.

Examples

			A160357 begins 1, 1; 1; -1, 1, 1; 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1; 1; -1, 1, -1, -1; 1, -1, 1, -1, 1, -1, 1, -1, 1, 1; 1; ..., where semicolons demark the successive runs.
		

Crossrefs

Extensions

Entry expanded by N. J. A. Sloane, Jul 15 2011

A064289 Height of n-th term in Recamán's sequence A005132.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Sep 25 2001

Keywords

Comments

The height of a term in A005132 = number of addition steps - number of subtraction steps to produce it.
Partial sums of A160357. - Allan C. Wechsler, Sep 08 2019

Examples

			A005132 begins 1, 3, 6, 2, 7, 13, 20, 12, ... and these terms have heights 1, 2, 3, 2, 3, 4, 5, 4, ...
		

Crossrefs

Programs

  • Maple
    g:= proc(n) is(n=0) end:
    b:= proc(n) option remember; local t;
          if n=0 then 0 else t:= b(n-1)-n; if t<=0 or g(t)
          then t:= b(n-1)+n fi; g(t):= true; t fi
        end:
    a:= proc(n) option remember; `if`(n=0, 0,
           a(n-1)+signum(b(n)-b(n-1)))
        end:
    seq(a(n), n=0..120);  # Alois P. Heinz, Sep 08 2019
  • Mathematica
    g[n_] := n == 0;
    b[n_] := b[n] = Module[{t}, If[n == 0, 0, t = b[n - 1] - n; If[t <= 0 || g[t], t = b[n - 1] + n]; g[t] = True; t]];
    a[n_] := a[n] = If[n == 0, 0, a[n - 1] + Sign[b[n] - b[n - 1]]];
    a /@ Range[0, 100] (* Jean-François Alcover, Apr 11 2020, after Alois P. Heinz *)

Extensions

a(0)=0 prepended by Allan C. Wechsler, Sep 08 2019

A210606 Length of the n-th edge of an L-toothpick structure which gives Recamán's sequence A005132.

Original entry on oeis.org

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

Views

Author

Omar E. Pol, Mar 24 2012

Keywords

Comments

Consider a toothpick structure formed by L-toothpicks connected by their endpoints. The endpoints of the L-toothpicks are placed on the main diagonal of the first quadrant. At stage 1 we place an L-toothpick with one of its endpoints on the origin. At stage n we place an L-toothpick of size n. The L-toothpicks are placed alternately, on one or another sector of the first quadrant, trying to make the structure have an exposed endpoint closest to the origin. The total length of all L-toothpicks after the n-th stage is A002378(n). The value of x and y of the endpoint of the structure after the n-th stage is equal to the n-th term of Recamán's sequence A005132(n). Note that we can get other illustrations of initial terms of Recamán's sequence by replacing each L-toothpick by a Q-toothpick or by a semicircumference. This structure is also one of the three views of the three-dimensional model for Recamán's sequence. For more information about L-toothpicks and Q-toothpicks, see A172310 and A187210.

Examples

			The summands are the size of the L-toothpicks:
a(1) = 1.
a(2) = 1 + 2 = 3.
a(3) = 2 + 3 = 5.
a(4) = 3.
a(5) = 4.
a(6) = 4.
a(7) = 5.
a(8) = 5 + 6 = 11.
a(9) = 6 + 7 = 13.
a(10) = 7.
		

Crossrefs

A160356 First differences of Recamán's sequence A005132.

Original entry on oeis.org

1, 2, 3, -4, 5, 6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16, 17, 18, 19, -20, 21, -22, -23, 24, -25, 26, -27, 28, -29, 30, -31, 32, 33, 34, -35, 36, -37, -38, 39, -40, 41, -42, 43, -44, 45, -46, 47, -48, 49, -50, 51, -52, 53, -54, 55, -56, 57, -58, 59, -60, 61, -62, 63
Offset: 1

Views

Author

M. F. Hasler, Jun 03 2009

Keywords

Crossrefs

Formula

a(n) = A005132(n)-A005132(n-1) = n*A160357(n).
As a set, A160356 = A057165 union -A057166.

A076213 2*a(n)-1 = sign(A005132(n+1)-A005132(n)).

Original entry on oeis.org

1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 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, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0
Offset: 0

Views

Author

Benoit Cloitre, Nov 03 2002

Keywords

Comments

Characteristic function of A057165 - 1. - M. F. Hasler, Jun 03 2009

Formula

Conjecture: let s(n)=sum(k=1, n, a(k)), then lim n ->infinity s(n)/n = 1/2; for any n, 2*s(n) > n; let v(n)=2*s(n)-n, then v(n)/log(n) is bounded and sum(k=1, n, v(k)) is asymptotic to c*n*log(n) with 1 < c < 3/2.
a(n) = 1-A160351(n+1) = (A160357(n)+1)/2. - M. F. Hasler, Jun 03 2009

Extensions

Added initial value a(0)=1. - M. F. Hasler, Jun 03 2009

A160351 Characteristic function of A057166.

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 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, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 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, 0, 0, 1, 0, 1
Offset: 1

Views

Author

M. F. Hasler, Jun 03 2009

Keywords

Formula

a(n) = (1-A160357(n))/2 = 1-A076213(n-1).

A210608 Number of intersections after n-th stage in the structure mentioned in A210606 using semicircumferences and counting the superposed intersections several times.

Original entry on oeis.org

0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 8, 14, 22, 28, 36, 43
Offset: 1

Views

Author

Omar E. Pol, Mar 25 2012

Keywords

Comments

The structure mentioned in A210606 is a model for the visualization of Recamán's sequence A005132.
First differs from A210609 at a(24).

Crossrefs

A210609 Number of intersections after n-th stage in the structure mentioned in A210606 using semicircumferences and counting the superposed intersections only once.

Original entry on oeis.org

0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 8, 14, 21, 27
Offset: 1

Views

Author

Omar E. Pol, Mar 25 2012

Keywords

Comments

The structure mentioned in A210606 is a model for the visualization of Recamán's sequence A005132.
First differs from A210608 at a(24).

Crossrefs

A210610 Number of semicircumferences in the n-th spiral of the structure mentioned in A210606.

Original entry on oeis.org

3, 11, 4, 10, 4, 28, 10, 24, 8, 2, 4, 9, 4, 2, 36, 12, 4, 2, 3, 28, 10, 52, 18, 32, 12, 15, 38, 14, 32, 12, 44, 16, 148, 50, 7, 22, 8, 3, 4, 2, 70, 24, 114, 42, 200, 68, 6, 2, 13
Offset: 1

Views

Author

Omar E. Pol, Mar 25 2012

Keywords

Comments

The structure mentioned in A210606 is a model for the visualization of Recamán's sequence A005132.

Crossrefs

A366911 a(n) = (A364054(n+1) - A364054(n)) / prime(n) (where prime(n) denotes the n-th prime number).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Oct 27 2023

Keywords

Comments

a(n) is the number of steps of size prime(n) in going from A364054(n) to A364054(n+1).

Examples

			a(7) = (A364054(8) - A364054(7)) / prime(7) = (19 - 2) / 17 = 1.
		

Crossrefs

Cf. A160357, A364054, A366912 (partial sums).

Programs

  • Mathematica
    nn = 2^16; c[] := False; m[] := 0; 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 - 1], c[k], j}, {(k - j)/p, True, k}], {n, 2, nn + 1}], n];
    Array[a, nn] (* Michael De Vlieger, Oct 27 2023 *)
  • PARI
    See Links section.
    
  • Python
    from itertools import count, islice
    from sympy import nextprime
    def A366911_gen(): # generator of terms
        a, aset, p = 1, {0,1}, 2
        while True:
            k, b = divmod(a,p)
            for i in count(-k):
                if b not in aset:
                    aset.add(b)
                    a, p = b, nextprime(p)
                    yield i
                    break
                b += p
    A366911_list = list(islice(A366911_gen(),30)) # Chai Wah Wu, Oct 27 2023
Showing 1-10 of 10 results.