A167195 a(2)=3, for n>=3, a(n)=a(n-1)+gcd(n, a(n-1)).
3, 6, 8, 9, 12, 13, 14, 15, 20, 21, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 44, 45, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 92, 93, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116
Offset: 2
Links
- G. C. Greubel, Table of n, a(n) for n = 2..1000
- E. S. Rowland, A natural prime-generating recurrence, Journal of Integer Sequences, 11 (2008), Article 08.2.8.
- Vladimir Shevelev, A new generator of primes based on the Rowland idea, arXiv:0910.4676 [math.NT], 2009.
Crossrefs
Programs
-
Mathematica
RecurrenceTable[{a[n] == a[n - 1] + GCD[n, a[n - 1]], a[2] == 3}, a, {n, 2, 100}] (* G. C. Greubel, Jun 05 2016 *)
Formula
a(n) = a(n-1) + 1 if gcd(a(n-1), n) = 1, or a(n) = 2*n otherwise. - Yifan Xie, Aug 20 2025
Extensions
Edited by Charles R Greathouse IV, Nov 02 2009
Comments