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

A334148 a(n) is the first term to repeat when following the same rules as Recamán's sequence A005132 but starting at n instead of 0.

Original entry on oeis.org

42, 20, 33, 3, 4, 5, 28, 6, 7, 8, 16, 15, 9, 10, 11, 19, 24, 21, 12, 13, 14, 15, 19, 23, 26, 15, 16, 17, 27, 21, 42, 44, 49, 18, 19, 20, 30, 36, 27, 48, 34, 59, 21, 22, 23, 21, 25, 29, 33, 36, 40, 45, 24, 25, 26, 23, 27, 31, 55, 79, 42, 46, 49, 27, 28, 29, 25, 29
Offset: 0

Views

Author

Scott R. Shannon, Apr 16 2020

Keywords

Comments

The terms of this sequence grow slowly as n increases and are confined to bands of certain values, see the link image. Between n = 998000 and n = 1000000 the smallest term is 2829 and the largest is 19331.
The number of terms in each sequence starting from n required to reach a(n) is given in A334219.
The values where a(n) = n are given in A334225.
The number of terms in each sequence starting from n required to reach a value greater than n given in A334149.

Examples

			a(0) = 42 as a(0) corresponds to the standard Recamán's sequence A005132 in which 42 is the first term to repeat, appearing at A005132(20) and then again at A005132(24).
a(3) = 3 as starting from 3 the sequence of visited numbers is 3,2,0,3 and 3 is the first term to repeat.
a(6) = 28 as starting from 6 the sequence of visited numbers is 6,5,3,0,4,9,15,8,16,7,17,28,40,27,13,28 and 28 is the first number to repeat.
		

Crossrefs

A334149 a(n) is the number of terms required beyond the starting value n before a value larger than n first appears when following the same rules as Recamán's sequence A005132 but starting at n instead of 0.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Apr 16 2020

Keywords

Comments

For 100 <= n <= 100000 the largest number of terms to surpass the starting value n is for n = 97646 which takes 26867 terms to surpass 97646, see the link image. The longest in terms of ratio of terms required compared to starting value is for n = 133 which takes 80 terms, see the link image. The shortest ratio is for n = 82148 which only takes 8587, see the link image.
The first repeated number in each sequence starting from n is given in A334148.
The number of terms in each sequence starting from n required to reach the first repeated number is given in A334219.

Examples

			a(0) = 1 as a(0) corresponds to the standard Recamán's sequence A005132 in which the first term is 0 and it only takes one more term to reach 1 and surpass the start value.
a(4) = 5 as starting from 4 the sequence of visited numbers is 4,3,1,4,0,5 and it takes five more terms to reach 5 and surpass the start value 4.
a(12) = 10 as starting from 12 the sequence of visited numbers is 12,11,9,6,2,7,1,8,0,9,19 and it takes ten more terms to reach 19 and surpass the start value 12.
		

Crossrefs

A334225 The values n where A334148(n) = n.

Original entry on oeis.org

3, 4, 5, 23, 140, 290
Offset: 0

Views

Author

Scott R. Shannon, Apr 19 2020

Keywords

Comments

See A334148 for the definition of the sequence and a plot of other n values.
There are no other values for n up to 1000000. As A334148(n) increase slowly for n, for example A334148(1000000) = 6655, it is almost certain that no other values exist.

Examples

			3 is a term as starting from 3 the sequence of visited numbers is 3,2,0,3 and 3 is the first term to repeat.
23 is a term as starting from 23 the sequence of visited numbers is 23,22,20,17,13,8,2,9,1,10,0,11,23 and 23 is the first term to repeat.
290 is a term as starting from 290 the sequence of visited numbers is 290,289,287,284,280,275,269,262,254,245,235,224,212,199,185,170,154,137,119,100,80,59,37,14,38,13,39,12,40,11,41,10,42,9,43,8,44,7,45,6,46,5,47,4,48,3,49,2,50,1,51,0,52,105,159,104,160,103,161,102,162,101,163,226,290 and 290 is the first term to repeat. This is almost certainly the largest such value.
		

Crossrefs

A308419 Stopping time for Recamán-like iteration of each n: a(0) = n, a(k) = a(k-1) - k if positive and not already in the sequence, a(k) = a(k-1) + k if not already in the sequence, otherwise stop.

Original entry on oeis.org

24, 24, 13, 21, 3, 3, 3, 15, 6, 6, 6, 15, 12, 9, 9, 9, 16, 20, 15, 12, 12, 12, 8, 10, 12, 20, 15, 15, 15, 10, 15, 24, 22, 26, 18, 18, 18, 11, 13, 18, 29, 28, 27, 21, 21, 21, 15, 13, 19, 17, 25, 31, 23, 24, 24, 24, 16, 18, 20, 21
Offset: 0

Views

Author

Kevin J. Gomez, May 25 2019

Keywords

Comments

a(0) is the index of the first repeated value in Recamán's sequence (A005132).
a(n) appears to grow like sqrt(2n).

Examples

			For n = 8, the Recamán-like sequence generated is 8, 7, 5, 2, 6, 1; the sequence halts after a(8) = 6 terms since 1 - 6 = -5 is negative and 1 + 6 = 7 is already in the sequence.
		

Crossrefs

Iteration rule nearly identical to A005132.
A334219 is essentially the same sequence.

Programs

  • Python
    def seqr(n):
        sequence = [n]
        i = 1
        while True:
            if n - i > 0 and n - i not in sequence:
                n -= i
                sequence.append(n)
            elif n + i not in sequence:
                n += i
                sequence.append(n)
            else:
                break
            i += 1
        return len(sequence)
    print([seqr(n) for n in range(1000)])

Formula

a(n) >= ceiling((sqrt(1 + 8*n)-1)/2). - Markel Zubia, May 03 2025
Showing 1-4 of 4 results.