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!)
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. 6

%I #44 Sep 08 2022 08:46:11

%S 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 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 2,1,59,118,2,1,63,126,2,1,67,134,2,1,71,142,2,1

%N 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 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 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 <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 a(4k+1) = 1, a(4k+2) = 4k+3, a(4k+3) = 2*a(4k+2) = 8k+6, a(4k) = 2.

%F 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 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 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 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 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 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 (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 (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 (Magma) &cat [[1, 4*n+3, 8*n+6, 2]: n in [0..20]]; // _Bruno Berselli_, Feb 16 2015

%Y Cf. A133058, A255140.

%K nonn,easy

%O 1,2

%A _M. F. Hasler_, Feb 15 2015

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 April 23 23:26 EDT 2024. Contains 371917 sequences. (Running on oeis4.)