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!)
A255140 a(1) = 1, a(n+1) = a(n)/gcd(a(n),n) if this gcd is > 1, else a(n+1) = a(n) + n + 2. 5
1, 4, 2, 7, 13, 20, 10, 19, 29, 40, 4, 17, 31, 46, 23, 40, 5, 24, 4, 25, 5, 28, 14, 39, 13, 40, 20, 49, 7, 38, 19, 52, 13, 48, 24, 61, 99, 138, 69, 23, 65, 108, 18, 63, 109, 156, 78, 127, 177, 228, 114, 38, 19, 74, 37, 94, 47, 106, 53, 114, 19, 82, 41, 106 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

A variant of A133058, less trivial than A255051: The sequence looks irregular up to index n = 82, where it enters a 4-periodic pattern (1, x, 2x, x), cf. formula. Sequence A255051 starts right from the beginning with the pattern (1, x, 2x, 2), whereas sequence A133058 enters such a pattern only at index n = 641.

LINKS

Harvey P. Dale, Table of n, a(n) for n = 1..1000

FORMULA

For k > 20, a(4k) = 8k + 2 = 2*a(4k +- 1), a(4k - 2) = 1; equivalently:

a(n) = 2n + 2, n, 1 or n+2 when n = 4k+r > 81 with r = 0, 1, 2 or 3, respectively.

EXAMPLE

a(2) = a(1) + 3 = 4, a(3) = a(2)/2 = 2, a(4) = a(3) + 5 = 7, a(5) = a(4) + 6 = 13, ...

MATHEMATICA

nxt[{n_, a_}]:=Module[{g=GCD[a, n]}, {n+1, If[g>1, a/g, a+n+2]}]; NestList[nxt, {1, 1}, 70][[All, 2]] (* Harvey P. Dale, Oct 12 2019 *)

PROG

(PARI) A255140_vec(N)=vector(N, n, if(gcd(N, n-1)>1||n==1, N/=gcd(N, n-1), N+=n+1)) \\ Original code simplified by M. F. Hasler, Jan 11 2020

(PARI) A255140(n)=if(n < 82, A255140_upto(n)[n], [2*n+2, n, 1, n+2][n%4+1]) \\ M. F. Hasler, Jan 17 2020

(MAGMA) a:=[1]; for n in [2..65] do if Gcd(a[n-1], n-1) gt 1 then Append(~a, a[n-1] div Gcd(a[n-1], n-1)); else Append(~a, a[n-1] +n+1); end if; end for; a; // Marius A. Burtea, Jan 11 2020

CROSSREFS

Cf. A133058, A255051.

Sequence in context: A201207 A151890 A227352 * A108167 A261690 A211941

Adjacent sequences:  A255137 A255138 A255139 * A255141 A255142 A255143

KEYWORD

nonn,easy

AUTHOR

M. F. Hasler, Feb 15 2015

EXTENSIONS

Edited by M. F. Hasler, Jan 11 2020

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified January 18 06:16 EST 2022. Contains 350444 sequences. (Running on oeis4.)