login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A166944
a(1)=2; a(n) = a(n-1) + gcd(n, a(n-1)) if n is even, a(n) = a(n-1) + gcd(n-2, a(n-1)) if n is odd.
12
2, 4, 5, 6, 9, 12, 13, 14, 21, 22, 23, 24, 25, 26, 39, 40, 45, 54, 55, 60, 61, 62, 63, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 129, 130, 135, 138, 139, 140, 147, 148, 149, 150, 151, 152, 153, 154, 155, 160, 161, 162, 163
OFFSET
1,1
COMMENTS
Conjecture: Every record of differences a(n)-a(n-1) more than 5 is the greater of twin primes (A006512).
LINKS
E. S. Rowland, A natural prime-generating recurrence, Journal of Integer Sequences, Vol.11(2008), Article 08.2.8. arXiv:0710.3217 [math.NT]
V. Shevelev, Three theorems on twin primes, arXiv:0911.5478 [math.NT], 2009-2010. - Vladimir Shevelev, Dec 03 2009
MAPLE
A166944 := proc(n) option remember; if n = 1 then 2; else p := procname(n-1) ; if type(n, 'even') then p+igcd(n, p) ; else p+igcd(n-2, p) ; end if; end if; end proc: # R. J. Mathar, Sep 03 2011
MATHEMATICA
nxt[{n_, a_}]:={n+1, If[OddQ[n], a+GCD[n+1, a], a+GCD[n-1, a]]}; Transpose[ NestList[ nxt, {1, 2}, 70]][[2]] (* Harvey P. Dale, Feb 10 2015 *)
PROG
(PARI) print1(a=2); for(n=2, 100, d=gcd(a, if(n%2, n-2, n)); print1(", "a+=d)) \\ Charles R Greathouse IV, Oct 13 2017
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Oct 24 2009
EXTENSIONS
Terms beginning with a(18) corrected by Vladimir Shevelev, Nov 10 2009
STATUS
approved