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
4, 6, 9, 10, 15, 18, 19, 20, 21, 22, 33, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 69, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 141, 144, 145, 150, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
REFERENCES
Eric S. Rowland, A simple prime-generating recurrence, Abstracts Amer. Math. Soc., 29 (No. 1, 2008), p. 50 (Abstract 1035-11-986).
LINKS
Indranil Ghosh, Table of n, a(n) for n = 1..50000 (terms 1..1000 from T. D. Noe)
Eric S. Rowland, A simple prime-generating recurrence, arXiv:0710.3217 [math.NT], 2007-2008.
MAPLE
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;
MATHEMATICA
a[1]= 4; a[n_]:= a[n]= a[n-1] + GCD[n, a[n-1]]; Table[a[n], {n, 70}]
nxt[{n_, a_}]:= {n+1, a + GCD[a, n+1]}; NestList[nxt, {1, 4}, 70][[All, 2]] (* Harvey P. Dale, Dec 25 2018 *)
PROG
(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 */
(Magma) [n eq 1 select 4 else Self(n-1)+Gcd(Self(n-1), n): n in [1..66]]; // Bruno Berselli, May 24 2011
(Haskell)
a084662 n = a084662_list !! (n-1)
a084662_list =
4 : zipWith (+) a084662_list (zipWith gcd a084662_list [2..])
-- Reinhard Zumkeller, Nov 15 2013
(SageMath)
@CachedFunction
def a(n): # a = A084662
if (n==1): return 4
else: return a(n-1) + gcd(a(n-1), n)
[a(n) for n in range(1, 71)] # G. C. Greubel, Mar 22 2023
CROSSREFS
Cf. A084663, A106108 and other sequences mentioned in A106108.
Cf. A134734 (first differences), A134736, A230504.
Sequence in context: A010462 A028957 A242664 * A137167 A181564 A119961
KEYWORD
nonn
AUTHOR
Matthew Frank (mfrank(AT)wopr.wolfram.com) on behalf of the 2003 New Kind of Science Summer School, Jul 15 2003
STATUS
approved

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 June 27 00:54 EDT 2024. Contains 373723 sequences. (Running on oeis4.)