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.

A340612 a(0) = 0; for n > 0, if n appears in the sequence then a(n) = lastindex(n), where lastindex(n) is the index of the last appearance of n. Otherwise a(n) = a(n-1) - n if nonnegative and not already in the sequence, otherwise a(n) = a(n-1) + n.

Original entry on oeis.org

0, 1, 3, 2, 6, 11, 4, 11, 19, 10, 9, 7, 19, 32, 18, 33, 17, 16, 14, 12, 32, 53, 31, 8, 32, 57, 83, 56, 28, 57, 27, 22, 24, 15, 49, 84, 48, 85, 47, 86, 46, 5, 47, 90, 134, 89, 40, 42, 36, 34, 84, 135, 187, 21, 75, 20, 27, 29, 87, 146, 206, 145, 207, 144, 80, 145, 79, 146, 78, 147, 77, 148, 76, 149
Offset: 0

Views

Author

Scott R. Shannon, Jan 13 2021

Keywords

Comments

This sequences uses the same rules as Recamán's sequence A005132 if the value of n itself has not previously appeared in the sequence. However if n has previously appeared then a(n) = lastindex(n), where lastindex(n) is the sequence index of the last appearance of n.
The terms appear to be clustered in bands which are themselves composed of thinner bands. No values appear outside these groupings. See the linked image.
The smallest value not to have appeared after 1 million terms is 13. It is unknown if all terms eventually appear.

Examples

			a(3) = 2, as a(2) = 3 = n, thus a(3) = 2.
a(5) = 11, as 5 has not previously appeared in the sequence, but 1 has, a(5) = a(4) + 5 = 6 + 5 = 11.
a(11) = 7, as a(7) = 11 = n, thus a(11) = 7.
		

Crossrefs

Programs

  • Python
    def aupton(nn):
      alst, index = [0], {0: 0} # data list, map of last occurrence
      for n in range(1, nn+1):
        if n in index:
          an = index[n]
        else:
          an = alst[-1] - n
          if an < 0 or an in index:
            an = alst[-1] + n
        alst.append(an)
        index[an] = n
      return alst
    print(aupton(65)) # Michael S. Branicky, Jan 13 2021

A336761 a(0) = 0, a(1) = 1; for n > 1, a(n) = a(n-1) - lpf(n) if nonnegative and not already in the sequence, otherwise a(n) = a(n-1) + lpf(n), where lpf(n) is the least prime dividing n.

Original entry on oeis.org

0, 1, 3, 6, 4, 9, 7, 14, 12, 15, 13, 2, 4, 17, 19, 16, 18, 35, 33, 52, 50, 47, 45, 22, 20, 25, 23, 26, 24, 53, 51, 82, 80, 77, 75, 70, 68, 31, 29, 32, 30, 71, 69, 112, 110, 107, 105, 58, 56, 49, 51, 48, 46, 99, 97, 92, 90, 87, 85, 144, 142, 81, 79, 76, 74, 79, 81, 148, 146, 143, 141, 212, 210
Offset: 0

Views

Author

Scott R. Shannon, Aug 03 2020

Keywords

Comments

This sequences uses the same rules as Recamán's sequence A005132 except that, instead of adding or subtracting n each term, the least prime dividing n is used. See A020639.
For the first 100 million terms the smallest value not appearing is 5. As any term for prime n can be the previous term minus n there is no apparent lower bound for the terms as n increases. For example a(16367081) = 601, the previous term being a(16367080) = 16367682. Thus it is possible 5, and eventually all values, are visited, although this is unknown.
In the same range the maximum value is a(98782561) = 602622357, and 7627043 terms repeat a previously visited value, the first time this occurs is a(12) = a(4) = 4. The longest run of consecutive increasing terms is 47, starting at a(96135288) = 26062, while the longest run of consecutive decreasing terms is 238, starting at a(32357989) = 160443385.

Examples

			a(2) = 3. As 2 is prime lpf(2) = 2 thus a(2) = a(1) + 2 = 1 + 2 = 3.
a(6) = 7. As lpf(6) = 2 and as 7 has not been previously visited and is nonnegative, a(6) = a(5) - 2 = 9 - 2 = 7.
		

Crossrefs

A340593 a(0) = 0; for n > 0, if n appears in the sequence then a(n) = a(n-1) - lastindex(n) if nonnegative and not already in the sequence, otherwise a(n) = a(n-1) + lastindex(n), where lastindex(n) is the index of the last appearance of n. Otherwise a(n) = a(n-1) - n if nonnegative and not already in the sequence, otherwise a(n) = a(n-1) + n.

Original entry on oeis.org

0, 1, 3, 5, 9, 6, 11, 4, 12, 8, 18, 24, 16, 29, 15, 29, 17, 33, 23, 42, 22, 43, 63, 45, 34, 59, 85, 58, 30, 45, 73, 104, 72, 55, 31, 66, 102, 65, 27, 66, 26, 67, 48, 69, 25, 54, 100, 53, 95, 46, 96, 147, 199, 152, 107, 74, 130, 187, 160, 135, 75, 14, 76, 98, 162, 125, 86, 127, 195, 238, 168, 97
Offset: 0

Views

Author

Scott R. Shannon, Jan 13 2021

Keywords

Comments

This sequences uses the same rules as Recamán's sequence A005132 if the value of n itself has not previously appeared in the sequence. However if n has previously appeared then the step size from a(n-1) is set to lastindex(n), where lastindex(n) is the sequence index of the last appearance of n.
The smallest value not to have appeared after 1 million terms is 52. It is unknown if all terms eventually appear.

Examples

			a(3) = 5 as a(2) = 3 = n, thus the step size from a(2) is 2. As 1 has previously appeared a(3) = a(2) + 2 = 3 + 2 = 5.
a(5) = 6 as a(3) = 5 = n, thus the step size from a(4) is 3. As 6 has not previously appeared a(5) = a(4) - 3 = 9 - 3 = 6.
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def A340593_gen(): # generator of terms
        a, ndict = 0, {0:0}
        yield 0
        for n in count(1):
            yield (a:= (a-m if a>=(m:=ndict[n]) and a-m not in ndict else a+m) if n in ndict else (a-n if a>=n and a-n not in ndict else a+n))
            ndict[a] = n
    A340593_list = list(islice(A340593_gen(),30)) # Chai Wah Wu, Jun 29 2023

A335372 a(0) = 0, a(1) = 1; for n > 1, a(n) = a(n-1) - A001065(n) if nonnegative and not already in the sequence, otherwise a(n) = a(n-1) + A001065(n), where A001065(n) is the sum of the proper divisors of n.

Original entry on oeis.org

0, 1, 2, 3, 6, 5, 11, 10, 17, 13, 21, 20, 4, 5, 15, 24, 9, 8, 29, 28, 50, 39, 25, 26, 62, 56, 40, 27, 55, 54, 12, 13, 44, 59, 79, 66, 121, 120, 98, 81, 31, 30, 84, 83, 43, 76, 102, 101, 177, 169, 126, 105, 151, 150, 216, 199, 135, 112, 80, 81, 189, 188, 154, 113, 176, 157, 235, 234, 292
Offset: 0

Views

Author

Scott R. Shannon, Aug 16 2020

Keywords

Comments

This sequences uses the same rules as Recamán's sequence A005132 except that, instead of adding or subtracting n each term, the sum of the proper divisors of n is used. See A001065.
For the first 10 million terms the smallest value not appearing is 46. As there are infinite abundant numbers it is likely that eventually all values are visited, although this is unknown.
In the same range the maximum value is a(9529524) = 65424507, and 633238 terms repeat a previously visited value, the first time this occurs is a(13) = a(5) = 5. The longest run of consecutive increasing terms is 8, starting at a(7069152) = 1040443, while the longest run of consecutive decreasing terms is 11, starting at a(106380) = 621777.

Examples

			a(2) = 2. As 2 is prime A001065(2) = 1, and 1 has previously appeared, a(2) = a(1) + 1 = 2.
a(4) = 6. As A001065(4) = 1+2 = 3, and 0 has previously appeared, a(4) = a(3) + 3 = 6.
a(5) = 5. As 5 is prime A001065(5) = 1, and 5 has not previously appeared, a(5) = a(4) - 1 = 5.
		

Crossrefs

A335382 a(0) = 0, a(1) = 1; for n > 1, a(n) = a(n-1) - sigma(n) if nonnegative and not already in the sequence, otherwise a(n) = a(n-1) + sigma(n), where sigma(n) is the sum of the divisors of n.

Original entry on oeis.org

0, 1, 4, 8, 15, 9, 21, 13, 28, 41, 23, 11, 39, 25, 49, 73, 42, 24, 63, 43, 85, 53, 17, 41, 101, 70, 112, 72, 16, 46, 118, 86, 149, 197, 143, 95, 186, 148, 88, 32, 122, 80, 176, 132, 48, 126, 54, 6, 130, 187, 94, 22, 120, 66, 186, 114, 234, 154, 64, 124, 292, 230, 134, 30, 157, 241, 97, 29, 155
Offset: 0

Views

Author

Scott R. Shannon, Aug 16 2020

Keywords

Comments

This sequences uses the same rules as Recamán's sequence A005132 except that, instead of adding or subtracting n each term, the sum of the divisors of n is used. See A000203.
For the first 10 million terms the smallest value not appearing is 76. It is likely that all values are eventually visited, although this is unknown.
In the same range the maximum value is a(9297600) = 93571073, and 402979 terms repeat a previously visited value, the first time this occurs is a(23) = a(9) = 41. The longest run of consecutive increasing terms is 5, starting at a(105187) = 25833, while the longest run of consecutive decreasing terms is 7, starting at a(6826248) = 83016261.

Examples

			a(2) = 4. As sigma(2) = 3, and a(1)<3, a(2) = a(1) + 3 = 4.
a(4) = 15. As sigma(4) = 7, and 1 has previously appeared, a(4) = a(3) + 7 = 15.
a(5) = 9. As sigma(5) = 6, and 9 has not previously appeared, a(5) = a(4) - 6 = 9.
		

Crossrefs

A340730 a(0) = 0, a(1) = 1; for n > 1, a(n) = a(n-1) - min(a(n-1),n) if nonnegative and not already in the sequence, otherwise a(n) = a(n-1) + min(a(n-1),n).

Original entry on oeis.org

0, 1, 2, 4, 8, 3, 6, 12, 20, 11, 21, 10, 20, 7, 14, 28, 44, 27, 9, 18, 36, 15, 30, 53, 29, 54, 80, 107, 79, 50, 80, 49, 17, 34, 68, 33, 66, 103, 65, 26, 52, 93, 51, 94, 138, 183, 137, 90, 42, 84, 134, 83, 31, 62, 116, 61, 5, 10, 20, 40, 80, 19, 38, 76, 140, 75, 141, 74, 142, 73, 143, 72, 144
Offset: 0

Views

Author

Scott R. Shannon, Jan 17 2021

Keywords

Comments

This sequence uses the same rules as Recamán's sequence A005132 except that the step size for each term n is set to the minimum of n and a(n-1).
The terms are slightly concentrated along the linear relationships a(n) = k*n, where k is an integer >= 1. Other values are distributed between these lines. See the linked image.
The smallest value not to have appeared after 5 million terms is 8697. It is unknown if all terms eventually appear.

Examples

			a(3) = 4 as min(3,a(2)) = min(3,2) = 2, and as 0 has already appeared a(3) = a(2) + 2 = 2 + 2 = 4.
a(5) = 3 as min(5,a(4)) = min(5,8) = 5, and as 3 has not already appeared a(5) = a(4) - 5 = 8 - 5 = 3.
		

Crossrefs

A340733 a(0) = 0; for n > 0, if the value of n itself appears in the sequence then a(n) = a(n-1) - (n-index(n)) if nonnegative and not already in the sequence, otherwise a(n) = a(n-1) + (n-index(n)), where index(n) is the index of the last appearance of n. If the value of n does not appear then a(n) = a(n-1) - n if nonnegative and not already in the sequence, otherwise a(n) = a(n-1) + n.

Original entry on oeis.org

0, 1, 3, 2, 6, 11, 9, 16, 8, 5, 15, 21, 33, 20, 34, 29, 38, 55, 37, 18, 25, 35, 13, 36, 12, 7, 33, 60, 32, 46, 76, 45, 41, 48, 28, 14, 27, 46, 24, 63, 23, 32, 74, 31, 75, 61, 52, 99, 84, 133, 83, 134, 128, 181, 127, 89, 145, 88, 30, 89, 56, 40, 102, 78, 142, 77, 143, 210, 278, 209, 139, 68
Offset: 0

Views

Author

Scott R. Shannon, Jan 17 2021

Keywords

Comments

This sequence uses the same rules as Recamán's sequence A005132 if the value of n itself has not previously appeared in the sequence. However if n has previously appeared then the step size from a(n-1) is set to be n - index(n), where index(n) is the sequence index of the last appearance of n.
The sequence values appear random up to a(45256) = 45257. As 45257 has then appeared in the sequence the step size for the next term is 45257 - index(45257) = 45257 - 452576 = 1. As a(42564) = 45256 the next term a(45257) must be a(45256) + 1 = 45257 + 1 = 45258. This pattern then repeats so all terms beyond a(45256) are just a(n-1) + 1. See the linked image.

Examples

			a(3) = 2 as a(2) = 3 = n, thus the step size from a(2) is 3 - index(3) = 3 - 2 = 1. As 2 has not previously appeared a(3) = a(2) - 1 = 3 - 1 = 2.
a(6) = 9 as a(4) = 6 = n, thus the step size from a(5) is 6 - index(6) = 6 - 4 = 2. As 9 has not previously appeared a(6) = a(5) - 2 = 11 - 2 = 9.
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def A340733_gen(): # generator of terms
        a, ndict = 0, {0:0}
        yield 0
        for n in count(1):
            yield (a:= (a-m if a>=(m:=n-ndict[n]) and a-m not in ndict else a+m) if n in ndict else (a-n if a>=n and a-n not in ndict else a+n))
            ndict[a] = n
    A340733_list = list(islice(A340733_gen(),30)) # Chai Wah Wu, Jun 29 2023

Formula

a(n) = n + 1 for n >= 45256.

A363653 a(1) = 1; for n > 1, a(n) = a(n-1) - A000005(n) if a(n) strictly positive, else a(n) = a(n-1) + A000005(n).

Original entry on oeis.org

1, 3, 1, 4, 2, 6, 4, 8, 5, 1, 3, 9, 7, 3, 7, 2, 4, 10, 8, 2, 6, 2, 4, 12, 9, 5, 1, 7, 5, 13, 11, 5, 1, 5, 1, 10, 8, 4, 8, 16, 14, 6, 4, 10, 4, 8, 6, 16, 13, 7, 3, 9, 7, 15, 11, 3, 7, 3, 1, 13, 11, 7, 1, 8, 4, 12, 10, 4, 8, 16, 14, 2, 4, 8, 2, 8, 4, 12, 10, 20, 15, 11, 9, 21
Offset: 1

Views

Author

Ctibor O. Zizka, Jun 13 2023

Keywords

Comments

Variation on Recamán's sequence A005132.

Examples

			a(1) = 1
a(2) = 1 + A000005(2) = 3
		

Crossrefs

Programs

  • Mathematica
    a[1] = 1; a[n_] := a[n] = Module[{d = DivisorSigma[0, n]}, If[a[n - 1] > d, a[n - 1] - d, a[n - 1] + d]]; Array[a, 100] (* Amiram Eldar, Jun 13 2023 *)
Showing 1-8 of 8 results.