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

A364929 a(0) = 0; for n > 0, if n appears in the sequence then a(n) is the product of the indices of all previous appearances 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, 35, 23, 36, 22, 7, 23, 40, 58, 8, 28, 49, 14, 192, 168, 143, 117, 90, 20, 49, 79, 48, 16, 49, 15, 11, 13, 50, 12, 51, 17, 58, 100, 57, 101, 56, 102, 55, 31, 20097, 37, 39, 91, 38, 92, 47, 45, 43, 738, 679, 619, 558, 496, 433, 369
Offset: 0

Views

Author

Kelvin Voskuijl, Dec 05 2023

Keywords

Examples

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

Crossrefs

Programs

  • PARI
    See PARI link
    
  • Python
    from itertools import count, islice
    def agen(): # generator of terms
        an, p = 0, {0: 0} # data list, map of product of indices
        for n in count(1):
            yield an
            an = p[n] if n in p else an+n if an-n < 0 or an-n in p else an-n
            p[an] = p[an]*n if an in p else n
    print(list(islice(agen(), 65))) # Michael S. Branicky, Dec 09 2023

Extensions

More terms from David A. Corneth, Dec 09 2023

A369829 a(0) = 0; for n > 0, if n appears in the sequence then a(n) = a(n-1) - sum of indexes where n appeared if that is nonnegative and not already in the sequence, otherwise a(n) = a(n-1) + sum of indexes. 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, 2, 30, 61, 93, 76, 52, 87, 51, 14, 52, 13, 53, 94, 75, 54, 10, 33, 79, 32, 80, 31, 81, 117, 189, 149, 106, 161, 105, 48, 21, 80, 20
Offset: 0

Views

Author

Kelvin Voskuijl, Feb 02 2024

Keywords

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.
a(29) = 2 as a(13) = 29 = n, and a(15) = 29, 13+15 is 28, thus the step size from a(2) is 28. As 2 has not previously appeared a(29) = a(29) - 28 = 30 - 28 = 2.
		

Crossrefs

Showing 1-2 of 2 results.