|
|
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.
|
|
7
|
|
|
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
|
|
|
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
(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
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|