This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A255051 #44 Sep 08 2022 08:46:11 %S A255051 1,3,6,2,1,7,14,2,1,11,22,2,1,15,30,2,1,19,38,2,1,23,46,2,1,27,54,2,1, %T A255051 31,62,2,1,35,70,2,1,39,78,2,1,43,86,2,1,47,94,2,1,51,102,2,1,55,110, %U A255051 2,1,59,118,2,1,63,126,2,1,67,134,2,1,71,142,2,1 %N A255051 a(1)=1, a(n+1) = a(n)/gcd(a(n),n) if this GCD is > 1, else a(n+1) = a(n) + n + 1. %C A255051 A somehow "trivial" variant of A133058 and A255140, both of which have very similar definitions, but enter 4-periodic loops only at later indices. %C A255051 There could be two motivated values for an initial term: either a(0)=0 which would yield a(1)=1 and the following values via the recursion formula, or a(0)=2 according to the general formula for a(4k). %H A255051 <a href="/index/Rec#order_08">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,2,0,0,0,-1). %F A255051 a(4k+1) = 1, a(4k+2) = 4k+3, a(4k+3) = 2*a(4k+2) = 8k+6, a(4k) = 2. %F A255051 G.f.: x*(1 + 3*x + 6*x^2 + 2*x^3 - x^4 + x^5 + 2*x^6 - 2*x^7)/((1 - x)^2*(1 + x)^2*(1 + x^2)^2). - _Bruno Berselli_, Feb 16 2015 %F A255051 a(n) = ( 2*(3 + (-1)^n) - (2 - 3*n + n*(-1)^n)*(1 - (-1)^((n-1)*n/2)) )/4. - _Bruno Berselli_, Feb 16 2015 %e A255051 a(2) = a(1)+2 = 3, a(3) = a(2)+3 = 6, a(4) = a(3)/3 = 2, a(5) = a(4)/2 = 1; %e A255051 a(6) = a(5)+6 = 7, a(7) = a(6)+7 = 14, a(8) = a(7)/7 = 2, a(9) = a(8)/2 = 1; ... %t A255051 Table[(2 (3 + (-1)^n) - (2 - 3 n + n (-1)^n) (1 - (-1)^((n - 1) n/2)))/4, {n, 1, 80}] (* _Bruno Berselli_, Feb 16 2015 *) %t A255051 nxt[{n_,a_}]:={n+1,If[GCD[a,n]>1,a/GCD[a,n],a+n+1]}; Transpose[ NestList[ nxt, {1,1},80]][[2]] (* or *) LinearRecurrence[{0,0,0,2,0,0,0,-1},{1,3,6,2,1,7,14,2},80] (* _Harvey P. Dale_, Oct 13 2015 *) %o A255051 (PARI) (A255051_upto(N)=vector(N, n, if(gcd(N, n-1)>1, N\=gcd(N, n-1), N+=n)))(99) \\ simplified by _M. F. Hasler_, Jan 11 2020 %o A255051 (PARI) A255051(n)=if(n%4>1,if(bittest(n,0),n*2,n+1),2-bittest(n,0)) \\ _M. F. Hasler_, Feb 18 2015 %o A255051 (Magma) &cat [[1, 4*n+3, 8*n+6, 2]: n in [0..20]]; // _Bruno Berselli_, Feb 16 2015 %Y A255051 Cf. A133058, A255140. %K A255051 nonn,easy %O A255051 1,2 %A A255051 _M. F. Hasler_, Feb 15 2015