%I #26 Sep 05 2020 13:15:23
%S 1,3,6,2,7,13,20,4,13,23,34,46,59,73,88,8,25,43,62,10,31,53,76,100,
%T 125,151,178,206,235,15,46,78,111,145,5,41,78,116,155,195,236,278,321,
%U 365,410,456,503,551,600,50,101,153,206,260,315,371,428,486,545,605,666,728,791,855,920,986,1053
%N 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.
%C This is a variation of A337490; here we start with an offset of 1, so a(1) = 1. See that sequence for further details.
%C 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.
%H Scott R. Shannon, <a href="/A333826/b333826.txt">Table of n, a(n) for n = 1..10000</a>
%H Scott R. Shannon, <a href="/A333826/a333826_1.png">Graph of the terms for n=1..4500</a>. This includes the last known decrease in the sequence, n(4166)=84.
%e 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.
%e 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.
%e 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.
%o (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
%Y Cf. A337490 (same sequence rules but starting a(0)=1), A333980, A165430, A064814, A082299, A005132, A336957.
%K nonn
%O 1,2
%A _Scott R. Shannon_, Sep 03 2020