login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A084662 a(1) = 4; a(n) = a(n-1) + gcd(a(n-1), n). 24

%I #29 Mar 22 2023 08:07:26

%S 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 73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,

%U 141,144,145,150,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168

%N a(1) = 4; a(n) = a(n-1) + gcd(a(n-1), n).

%D Eric S. Rowland, A simple prime-generating recurrence, Abstracts Amer. Math. Soc., 29 (No. 1, 2008), p. 50 (Abstract 1035-11-986).

%H 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 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 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 a[1]= 4; a[n_]:= a[n]= a[n-1] + GCD[n, a[n-1]]; Table[a[n], {n, 70}]

%t nxt[{n_, a_}]:= {n+1, a + GCD[a, n+1]}; NestList[nxt,{1,4},70][[All,2]] (* _Harvey P. Dale_, Dec 25 2018 *)

%o (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 (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 (Haskell)

%o a084662 n = a084662_list !! (n-1)

%o a084662_list =

%o 4 : zipWith (+) a084662_list (zipWith gcd a084662_list [2..])

%o -- _Reinhard Zumkeller_, Nov 15 2013

%o (SageMath)

%o @CachedFunction

%o def a(n): # a = A084662

%o if (n==1): return 4

%o else: return a(n-1) + gcd(a(n-1), n)

%o [a(n) for n in range(1,71)] # _G. C. Greubel_, Mar 22 2023

%Y Cf. A084663, A106108 and other sequences mentioned in A106108.

%Y Cf. A134734 (first differences), A134736, A230504.

%K nonn

%O 1,1

%A Matthew Frank (mfrank(AT)wopr.wolfram.com) on behalf of the 2003 New Kind of Science Summer School, Jul 15 2003

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 22:36 EDT 2024. Contains 371917 sequences. (Running on oeis4.)