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”).

A099427
a(1) = 1; for n > 1, a(n) = 1 + greatest common divisor of n and a(n-1).
3
1, 2, 2, 3, 2, 3, 2, 3, 4, 3, 2, 3, 2, 3, 4, 5, 2, 3, 2, 3, 4, 3, 2, 3, 2, 3, 4, 5, 2, 3, 2, 3, 4, 3, 2, 3, 2, 3, 4, 5, 2, 3, 2, 3, 4, 3, 2, 3, 2, 3, 4, 5, 2, 3, 2, 3, 4, 3, 2, 3, 2, 3, 4, 5, 6, 7, 2, 3, 4, 3, 2, 3, 2, 3, 4, 5, 2, 3, 2, 3, 4, 3, 2, 3, 2, 3, 4, 5, 2, 3, 2, 3, 4, 3, 2, 3, 2, 3, 4, 5, 2, 3, 2, 3, 4
OFFSET
1,2
COMMENTS
a(A060401(n)) = n + 1; a(A192489(n)) = 2. - Reinhard Zumkeller, Jul 02 2011
For n >= 3, a(n) == n+1 (mod 2). - Robert Israel, Jan 10 2017
LINKS
EXAMPLE
a(9)=4 because 1+gcd(a(8),9)=1+gcd(3,9)=1+3.
MAPLE
f:= proc(n) option remember; 1 + igcd(n, procname(n-1)) end proc:
f(1):= 1:
map(f, [$1..1000]); # Robert Israel, Jan 10 2017
MATHEMATICA
a[1] = 1; a[n_] := a[n] = GCD[n, a[n - 1]] + 1; Table[ a[n], {n, 105}] (* Robert G. Wilson v, Nov 18 2004 *)
nxt[{n_, a_}]:={n+1, GCD[n+1, a]+1}; Transpose[NestList[nxt, {1, 1}, 110]] [[2]] (* Harvey P. Dale, Nov 22 2014 *)
PROG
(Haskell)
a099427 n = a099427_list !! (n-1)
a099427_list = 1 : map (+ 1) (zipWith gcd [2..] a099427_list)
-- Reinhard Zumkeller, Jun 23 2015, Jul 02 2011
CROSSREFS
For position of first occurrence of n see A060401.
Sequence in context: A185816 A324901 A295568 * A059964 A308050 A248147
KEYWORD
easy,nonn,nice
AUTHOR
Gaetan Polard (gaetan27(AT)hotmail.com), Nov 18 2004
EXTENSIONS
Edited and extended by Robert G. Wilson v, Nov 18 2004
STATUS
approved