login
A333826
a(1)=1; for n>1, 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.
2
1, 3, 6, 2, 7, 13, 20, 4, 13, 23, 34, 46, 59, 73, 88, 8, 25, 43, 62, 10, 31, 53, 76, 100, 125, 151, 178, 206, 235, 15, 46, 78, 111, 145, 5, 41, 78, 116, 155, 195, 236, 278, 321, 365, 410, 456, 503, 551, 600, 50, 101, 153, 206, 260, 315, 371, 428, 486, 545, 605, 666, 728, 791, 855, 920, 986, 1053
OFFSET
1,2
COMMENTS
This is a variation of A337490; here we start with an offset of 1, so a(1) = 1. See that sequence for further details.
In the first 4212 terms the sequence decreases 69 times while 45 terms are repeated, the first being 13 at n=9 and the last 399876 at n=4212. After n(4166)=84 the sequence does not decrease again for n up to at least 100 million. The lowest numbers that have not appeared in that range are 30,37,47,48,49,51. The 100 millionth term is 4999999941527298.
LINKS
Scott R. Shannon, Graph of the terms for n=1..4500. This includes the last known decrease in the sequence, n(4166)=84.
EXAMPLE
a(2) = 3 as the sum of all previous terms is a(1) = 1, and the GCD of 1 and 2 is 1. However 1 has already appeared so a(2) = a(1) + n = 1 + 2 = 3.
a(4) = 2 as the sum of all previous terms is a(1)+a(2)+a(3) = 10, and the GCD of 10 and 4 is 2, and as 2 has not previous appeared a(4) = 2.
a(8) = 4 as the sum of all previous terms is a(1)+...+a(7) = 52, and the GCD of 52 and 8 is 4, and as 4 has not previous appeared a(8) = 4.
PROG
(PARI) lista(nn) = {my(va = vector(nn), s=0); va[1] = 1; s += va[1]; for (n=2, nn, my(g = gcd(n, s)); if (#select(x->(x==g), va), va[n] = va[n-1]+n, va[n] = g); s += va[n]; ); va; } \\ Michel Marcus, Sep 05 2020
CROSSREFS
Cf. A337490 (same sequence rules but starting a(0)=1), A333980, A165430, A064814, A082299, A005132, A336957.
Sequence in context: A078783 A273465 A328503 * A125717 A065232 A074170
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Sep 03 2020
STATUS
approved