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.

Previous Showing 61-70 of 230 results. Next

A330789 Terms of A005132 corresponding to the values in A330788.

Original entry on oeis.org

1, 2, 14, 27, 26, 40, 5, 4, 830, 829, 828, 1414, 1354, 1306, 835, 834, 366, 19, 4202, 57520, 14804, 23289, 14510, 2426, 2405, 1814, 1643, 1355
Offset: 1

Views

Author

Jud McCranie, Dec 31 2019

Keywords

Crossrefs

Programs

  • Mathematica
    Block[{s = Rest@ Nest[Append[#, If[And[#3 > 0, FreeQ[#1, #3]], #3, #1[[-1]] + #2]] & @@ {#, Length@ #, #[[-1]] - Length@ #} &, {0}, 10^5], t, u}, t = MapIndexed[First[#2]/#1 &, s]; u = MapAt[1 &, #, 1] &@ Union@ FoldList[Max, Rest@ t]; Map[s[[ FirstPosition[t, #][[1]] ]] &, u]] (* Michael De Vlieger, Jan 01 2020 *)

A334494 Positions k of addition steps in Recamán's sequence A005132 where A005132(k-1)

Original entry on oeis.org

1, 2, 5, 13, 15, 17, 24, 26, 28, 30, 32, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 112, 130, 132, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, 223, 250
Offset: 1

Views

Author

N. J. A. Sloane, May 04 2020

Keywords

Comments

This is A187921 with the terms in A333548 removed. (The difference between A187921 and the present sequence is explained by the fact that originally A005132 began at 1 rather than 0.)

Crossrefs

A334950 Pairs (a,b) where "a" is the smallest candidate for the n-th term of Recamán's sequence and "b" is the n-th term of Recamán's sequence (A005132).

Original entry on oeis.org

0, 0, -1, 1, -1, 3, 0, 6, 2, 2, -3, 7, 1, 13, 6, 20, 12, 12, 3, 21, 11, 11, 0, 22, 10, 10, -3, 23, 9, 9, -6, 24, 8, 8, -9, 25, 7, 43, 24, 62, 42, 42, 21, 63, 41, 41, 18, 18, -6, 42, 17, 17, -9, 43, 16, 16, -12, 44, 15, 15, -15, 45, 14, 14, -18, 46, 13, 79, 45, 113, 78, 78, 42, 114, 77, 77, 39, 39, 0, 78
Offset: 0

Views

Author

Omar E. Pol, May 17 2020

Keywords

Comments

For n > 0 and after A005132(n-1) the algorithm of Recamán's sequence first explores if A005132(n-1) - n = A334951(n) is a valid number to be its n-th term. If A334951(n) is nonnegative and not already in Recamán's sequence then it is accepted, so A005132(n) = A334951(n), otherwise A334951(n) is rejected and A005132(n) = A005132(n-1) + n, not A334951(n). This sequence lists the pairs [A334951(n), A005132(n)], with a(0) = 0.

Examples

			Illustration of initial terms:
                                                       23
                                               22       _
                                       21       _      |
                               20       _      | |     |
                                _      | |     | |     |
                               | |     | |     | |     |
                               | |     | |     | |     |
                               | |     | |     | |     |
                               | |     | |     | |     |
                               | |     | |     | |     |
                           13  | |     | |     | |     |
                            _  | | 12  | |     | |     |
                           | | | |_ _  | | 11  | |     |
                           | | |     | | |_ _  | |  10 |
                           | | | 12  | |     | | |_ _  |
                           | | |     | | 11  | |     | |
                        7  | | |     | |     | | 10  | |
                6       _  | | |     | |     | |     | |
                _      | | | |_|     | |     | |     | |
               | |     | | |         | |     | |     | |
            3  | |     | | |  6      | |     | |     | |
            _  | |  2  | | |         |_|     | |     | |
        1  | | | |_ _  | | |                 | |     | |
    0   _  | | |     | | |_|          3      | |     | |
  _ _  | | | |_|  2  | |                     |_|     | |
     |_| |_|         | |  1                          | |
  0           0      | |                      0      | |
     -1  -1          |_|                             |_|
.
                     -3                              -3
.
In the above diagram the numbers that are written below the path are the terms of A334951 (the candidates for A005132). The numbers that are written above the path are the terms of Recamán's sequence A005132. The length of the n-th vertical-line-segment equals the absolute value of A334952(n).
For n = 4, after A005132(4-1) = 6 the algorithm of Recamán's sequence first explores if A334951(4) = 6 - 4 = 2 is a valid number to be its 4th term. We can see that 2 is nonnegative and not already in Recamán's sequence, then it is accepted, so A005132(4) = A334951(4) = 2.
For n = 5, after A005132(5-1) = 2 the algorithm first explores if A334951(5) = 2 - 5 = -3 is a valid number to be its 5th term. We can see that -3 is negative, so -3 is rejected.
For n = 6, after A005132(6-1) = 7 the algorithm first explores if A334951(6) = 7 - 6 = 1 is a valid number to be its 6th term. We can see that 1 is already in Recamán's sequence, so 1 is rejected.
		

Crossrefs

Cf. A334951 and A005132 interleaved.
Cf. A334952 (first differences).

Formula

a(2n) = A334951(n).
a(2n+1) = A005132(n).

A335924 A variation on Recamán's sequence (A005132): a(0) = 0, a(n) = a(n-1) - n if nonnegative and not already in the sequence; otherwise, a(n) = a(n-1) + ceiling(n/2) if not already in the sequence and a(n) = a(n-1) + n if already in the sequence.

Original entry on oeis.org

0, 1, 2, 4, 6, 9, 3, 7, 11, 16, 21, 10, 22, 29, 15, 23, 31, 14, 32, 13, 33, 12, 34, 46, 58, 71, 45, 18, 46, 17, 47, 63, 79, 96, 62, 27, 63, 26, 64, 25, 65, 24, 66, 88, 44, 67, 90, 43, 91, 42, 92, 41, 93, 40, 94, 39, 95, 38, 96, 37, 97, 36, 98, 35, 99, 132, 165
Offset: 0

Views

Author

Ya-Ping Lu, Jun 29 2020

Keywords

Comments

In this sequence, a forward step of ceiling(n/2) is added if a(n) - n is negative and a(n-1) + ceiling(n/2) is not already in the sequence. As a result, both the number of distinct numbers and the number of distinct numbers as a percentage of the biggest number in the sequence (called "coverage") are increased.
The smallest missing numbers, h1, from the first m terms of the sequence, given as h1(m), are: 3(6), 5(11097), 57(49518), 149(92113), 159(124908), ... All integers less than or equal to h1 can be found in the first m+1 terms of the sequence.
The number of consecutive numbers (Nc, from 0 to Nc-1), the distinct numbers (Nd), the biggest number (a_max), and the "coverage" for n=0~1000000 in the sequences with different forward and backward steps are given below:
Sequence Backward Forward Nc Nd a_max coverage
A005132 -n +n 1355 736749 5946126 12.39%
A335923 -n +n/2 620 694811 4350902 15.97%
"B" -n +n/4 577 696167 3132344 22.23%
A335924 -n +n/2, +n 160 813204 5698099 14.27%
"C" -n +n/4, +n/2 1330 779087 3757167 20.74%
"D" -2n, -n +n/2, +n 24 901949 3639015 24.79%
"E" -2n, -n +n/4, +n/2 3414 817174 3128675 26.12%

Crossrefs

Programs

  • Mathematica
    Nest[Append[#1, If[And[#3 >= 0, FreeQ[#1, #3]], #3, If[FreeQ[#1, #4], #4, #1[[-1]] + #2]]] & @@ {#1, #2, #1[[-1]] - #2, #1[[-1]] + Ceiling[#2/2]} & @@ {#, Length@ #} &, {0}, 10^5] (* Michael De Vlieger, Sep 09 2020 *)
  • Python
    import math
    n_max = 1000000
    a_last = 0
    list1 = [a_last]
    print(0)
    for n in range(1, n_max+1):
        m1 = a_last - n
        m2 = a_last + math.ceil(n/2)
        if m1 >= 0 and m1 not in list1:
            a = m1
        elif m2 not in list1:
            a = m2
        else:
            a = a_last + n
        list1.append(a)
        print(a)
        a_last = a
    
  • Python
    from itertools import count, islice
    def A335924_gen(): # generator of terms
        a, aset = 0, set()
        for n in count(1):
            yield a
            aset.add(a)
            a = b if (b:=a-n)>=0 and b not in aset else c if (c:=(n+1>>1)+a) not in aset else a+n
    A335924_list = list(islice(A335924_gen(),70)) # Chai Wah Wu, Sep 15 2022

A356080 Variation on Recamán's sequence (A005132) that is intended to be a permutation of the nonnegative integers, essentially as envisaged by the original comments in A078943. See comments below for details.

Original entry on oeis.org

0, 1, 3, 6, 2, 7, 13, 20, 28, 37, 27, 16, 4, 17, 31, 46, 30, 47, 29, 48, 68, 89, 111, 134, 158, 133, 159, 132, 160, 131, 101, 70, 38, 5, 39, 74, 110, 147, 109, 148, 108, 149, 107, 150, 106, 151, 105, 58, 10, 59, 9, 60, 8, 61, 115, 170, 226, 283, 341, 400, 460, 399, 337, 274, 210, 145, 79, 12, 80, 11
Offset: 1

Views

Author

Peter Munn, Jul 25 2022

Keywords

Comments

a(1) = 0; for n >= 1, a(n+1) = a(n)-n or a(n)+n; and no two terms are equal.
Subject to the pairwise constraints above, the sequence describes a path between (nodes labeled with) nonnegative integers that is extended in stages so that the extended path ends with the least missing number from the unextended path.
We denote the number at the end of the unextended path as k, the path from 0 to k as P_k and the least number absent from P_k as m_k. We call a path that starts at k an extension route if it extends P_k and satisfies the pairwise constraints. [clarification added, Peter Munn, Aug 07 2024]
An extension route R_k from P_k is suitable if (1) R_k ends in m_k and (2) R_k is the start of a "look-ahead" extension route (R_k + R') that ends in a record number (i.e., greater than the largest in P_k + R_k). If there is no suitable R_k the sequence finishes at k. Otherwise we denote the lexicographically earliest shortest such R_k as E_m_k, and extend P_k as P_m_k = P_k + E_m_k.
Note that any E_m_k ends in m_k (i.e., without any look-ahead R' being included) and so E_k ends in k and beware the sequence might end there. Nevertheless, once we determine that the sequence continues and includes m_k (perhaps because at least 1 suitable R_k has been found) 1 or more terms of E_m_k will be known, and this is the point in time we may include terms after k in the published sequence.
Conjecture (Peter Munn): the sequence is infinite and so a permutation of the nonnegative integers.

Examples

			a(2) = a(1) + 1 = 1, since a(1) - 1 = -1 is a negative integer.
We now find the lexicographically earliest shortest route to the least missing number, 2. Any extension route has a(3) = a(2) + 2 = 3 since a(2) - 2 = -1 is a negative integer. Any extension route has a(4) = a(3) + 3 = 6, since a(3) - 3 = 0 is already in the sequence. So a(3) = 3, a(4) = 6, a(5) = a(4) - 4 = 2 is the only way to reach 2 by a(5); no shorter route exists. Lastly, we must check an onward route exists to a new record term (greater than 6). This is provided by a(6) = a(5) + 5 = 7, so we have determined a(3) = 3, a(4) = 6, a(5) = 2.
		

Crossrefs

Formula

|a(n) - a(n+1)| = n.
If a(n) = a(m) then n = m.

A356839 a(n) = A005132(2*n) + A005132(2*n+1).

Original entry on oeis.org

1, 9, 9, 33, 33, 33, 33, 33, 33, 105, 105, 59, 59, 59, 59, 59, 125, 191, 191, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 381, 381, 381, 381, 381, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 429, 631, 631, 631, 631, 191, 417, 873, 873
Offset: 0

Views

Author

Paul Curtz, Aug 31 2022

Keywords

Crossrefs

Cf. A005132.

Programs

  • Mathematica
    r[0] = 0; r[n_] := r[n] = If[(d = r[n - 1] - n) >= 0 && FreeQ[Array[r, n, 0], d], d, r[n - 1] + n]; a[n_] := r[2*n] + r[2*n + 1]; Array[a, 100, 0] (* Amiram Eldar, Sep 02 2022 *)
  • PARI
    recaman(N)={ my(s, t, v=vector(N)); for(n=1, N, s=bitor(s, 1<A005132
    lista(nn) = my(v=recaman(2*nn+2)); vector(nn, k, v[2*k] + v[2*k-1]); \\ Michel Marcus, Sep 02 2022
    
  • Python
    from itertools import count, islice
    def A356839_gen(): # generator of terms
        b, aset = 0, set()
        for n in count(1):
            aset.add(b)
            a, b = b, c if (c:=b-n)>=0 and c not in aset else b+n
            if n&1:
                yield a+b
    A356839_list = list(islice(A356839_gen(),70)) # Chai Wah Wu, Sep 15 2022

A064369 Smallest integer in Recamán's sequence (A005132) to appear n times.

Original entry on oeis.org

0, 42, 261, 490, 494, 5447, 10023, 18519, 33543, 34292, 62263, 62267, 113405, 113406, 199251, 199252, 199504, 2060609, 2060610, 2060612, 2060614, 2060616, 2060617, 2060618, 2060701, 11526662, 11526664, 11526665, 11526667, 11526670, 11526840, 11526842, 11526845, 11526855, 20389507
Offset: 1

Views

Author

Robert G. Wilson v, Sep 26 2001

Keywords

Crossrefs

Cf. A005132.

Programs

  • Mathematica
    a = {1}; Do[ If[ a[ [ -1 ] ] - n > 0 && Position[ a, a[ [ -1 ] ] - n ] == {}, a = Append[ a, a[ [ -1 ] ] - n ], a = Append[ a, a[ [ -1 ] ] + n ] ], {n, 2, 10^5} ]; b = Sort[ a ]; Do[ k = 1; While[ b[ [ k ] ] != b[ [ k + n ] ], k++ ]; Print[ b[ [ k ] ] ], {n, 1, 13} ]

Extensions

a(15)-a(35) by Jud McCranie, Dec 21 2019

A065038 Values of Recamán's sequence A005132 at start of n-th segment (see A064492).

Original entry on oeis.org

1, 3, 2, 20, 10, 41, 38, 75, 268, 247, 1361, 2533, 3041, 2751, 15135, 18635, 51668, 62443, 57070, 398963, 181693, 1313022, 2359729, 1034838, 5365613, 3225918, 17353757, 10212210, 73599139, 96446382, 58056874, 407076917, 520187758, 908672243, 2046244881, 2712110771, 6440748154, 11156601694, 14732275193, 8416580354, 41424646066, 23006557538, 78977395399, 65854567302, 107078836273, 188471115226, 650749252297, 1071511376043, 872467803893, 2809440878107, 2402964238973, 7766036476659, 18849502773536, 10125357598982, 32332611300121, 102943941995445, 163227751205887, 193885933162482, 307443058720011, 159888464280046, 250759470174413, 394178473635587, 599819882554934, 2818367283068173
Offset: 1

Views

Author

Allan Wilks, Nov 06 2001

Keywords

A065051 Let R(n) = n-th term of Recamán's sequence A005132; write R(n) = q*n + r with 0 <= r < n; sequence gives values of q.

Original entry on oeis.org

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

Views

Author

Allan Wilks, Nov 06 2001

Keywords

Crossrefs

A065053 Lengths of intervals between special points in Recamán's sequence A005132.

Original entry on oeis.org

1, 2, 3, 5, 10, 18, 37, 58, 114, 205, 391, 676, 1232, 2293, 4272, 7906, 13998, 25850, 42670, 81952, 146562, 261677, 444906, 753699, 1437381, 2558667, 4427625, 8187574, 13749010, 25908081, 43712354, 71626690, 129494829, 208670472, 392475704, 706150114, 1178963385, 2121607974, 3505821957, 5391635001, 9198342183, 16482140162, 26365869602, 41224268971, 81392278953, 136903510922, 210381061873, 336712115872, 532252635160, 998243799920, 1480053999356, 2400149352850, 3842190007803, 6040948051078, 9569679848801, 15070952302611, 23821706586022, 37852375185843, 57407444706709, 90871005894367, 143419003461175, 205641408919347, 339635878467789, 530661445779104
Offset: 1

Views

Author

Allan Wilks, Nov 06 2001

Keywords

Crossrefs

First differences of A064492.
Previous Showing 61-70 of 230 results. Next