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.

A337490 a(0)=1; for n > 0, a(n) = the greatest common divisor (GCD) of n and the sum of all previous terms if the GCD is not already in the sequence; otherwise a(n) = a(n-1) + n.

Original entry on oeis.org

1, 2, 4, 7, 11, 5, 6, 13, 21, 30, 10, 21, 33, 46, 14, 29, 45, 62, 18, 37, 57, 78, 22, 45, 69, 94, 26, 53, 81, 110, 140, 171, 203, 236, 270, 305, 341, 378, 416, 39, 79, 120, 162, 205, 249, 294, 340, 387, 3, 52, 102, 17, 69, 122, 176, 231, 287, 344, 402, 461, 521, 582, 644, 707, 771, 836, 902, 969
Offset: 0

Views

Author

Scott R. Shannon, Aug 29 2020

Keywords

Comments

The sequence displays the unusual behavior of decreasing 53 times in the first 1975 terms, due to the existence of a GCD which has not previously appeared in the sequence, but then not decreasing again for n up to at least 100 million. In this period there are 37 repeated terms, the first being 21 at n=11 and the last 161202 at n=2054. In the same range many values do not appear, for example 16,23,28,32,36. It is unknown when the sequence decreases again, or if all values eventually appear. The 100 millionth term is 4999999948050717.
See the companion sequence A333980 for the sum of the terms from a(0) to a(n).

Examples

			a(2) = 4 as the sum of all previous terms is a(0)+a(1) = 3, and the GCD of 3 and 2 is 1, which has already appeared in the sequence. Therefore a(2) = a(1) + n = 2 + 2 = 4.
a(4) = 11 as the sum of all previous terms is a(0)+...+a(3) = 14, and the GCD of 14 and 4 is 2. However 2 has already appeared so a(4) = a(3) + n = 7 + 4 = 11.
a(5) = 5 as the sum of all previous terms is a(0)+...+a(4) = 25, and the GCD of 25 and 5 is 5, and as 5 has not previous appeared a(5) = 5.
		

Crossrefs

Cf. A333980, A333826 (same rules but starting a(1)=1), A165430, A064814, A082299, A005132, A336957.

Programs

  • PARI
    lista(nn) = {my(va = vector(nn), s=0); va[1] = 1; s += va[1]; for (n=2, nn, my(g = gcd(n-1, s)); if (#select(x->(x==g), va), va[n] = va[n-1]+n-1, va[n] = g); s += va[n];); va;} \\ Michel Marcus, Sep 05 2020