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.
%I A084662 #29 Mar 22 2023 08:07:26 %S A084662 4,6,9,10,15,18,19,20,21,22,33,36,37,38,39,40,41,42,43,44,45,46,69,72, %T A084662 73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94, %U A084662 141,144,145,150,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168 %N A084662 a(1) = 4; a(n) = a(n-1) + gcd(a(n-1), n). %D A084662 Eric S. Rowland, A simple prime-generating recurrence, Abstracts Amer. Math. Soc., 29 (No. 1, 2008), p. 50 (Abstract 1035-11-986). %H A084662 Indranil Ghosh, <a href="/A084662/b084662.txt">Table of n, a(n) for n = 1..50000</a> (terms 1..1000 from T. D. Noe) %H A084662 Eric S. Rowland, <a href="https://arxiv.org/abs/0710.3217">A simple prime-generating recurrence</a>, arXiv:0710.3217 [math.NT], 2007-2008. %p A084662 S := 4; f := proc(n) option remember; global S; if n=1 then S else f(n-1)+igcd(n,f(n-1)); fi; end; %t A084662 a[1]= 4; a[n_]:= a[n]= a[n-1] + GCD[n, a[n-1]]; Table[a[n], {n, 70}] %t A084662 nxt[{n_, a_}]:= {n+1, a + GCD[a, n+1]}; NestList[nxt,{1,4},70][[All,2]] (* _Harvey P. Dale_, Dec 25 2018 *) %o A084662 (Maxima) a[1]:4$ a[n]:=a[n-1]+gcd(a[n-1],n)$ makelist(a[n], n, 1, 66); /* _Bruno Berselli_, May 24 2011 */ %o A084662 (Magma) [n eq 1 select 4 else Self(n-1)+Gcd(Self(n-1),n): n in [1..66]]; // _Bruno Berselli_, May 24 2011 %o A084662 (Haskell) %o A084662 a084662 n = a084662_list !! (n-1) %o A084662 a084662_list = %o A084662 4 : zipWith (+) a084662_list (zipWith gcd a084662_list [2..]) %o A084662 -- _Reinhard Zumkeller_, Nov 15 2013 %o A084662 (SageMath) %o A084662 @CachedFunction %o A084662 def a(n): # a = A084662 %o A084662 if (n==1): return 4 %o A084662 else: return a(n-1) + gcd(a(n-1), n) %o A084662 [a(n) for n in range(1,71)] # _G. C. Greubel_, Mar 22 2023 %Y A084662 Cf. A084663, A106108 and other sequences mentioned in A106108. %Y A084662 Cf. A134734 (first differences), A134736, A230504. %K A084662 nonn %O A084662 1,1 %A A084662 Matthew Frank (mfrank(AT)wopr.wolfram.com) on behalf of the 2003 New Kind of Science Summer School, Jul 15 2003