A133058 a(0) = a(1) = 1; for n > 1, a(n) = a(n-1) + n + 1 if a(n-1) and n are coprime, otherwise a(n) = a(n-1)/gcd(a(n-1),n).
1, 1, 4, 8, 2, 8, 4, 12, 3, 1, 12, 24, 2, 16, 8, 24, 3, 21, 7, 27, 48, 16, 8, 32, 4, 30, 15, 5, 34, 64, 32, 64, 2, 36, 18, 54, 3, 41, 80, 120, 3, 45, 15, 59, 104, 150, 75, 123, 41, 91, 142, 194, 97, 151, 206, 262, 131, 189, 248, 308, 77, 139, 202, 266, 133, 199, 266, 334, 167
Offset: 0
Links
- N. J. A. Sloane, Table of n, a(n) for n = 0..10000, May 26 2016 [First 1000 terms from Harvey P. Dale]
- Dana G. Korssjoen, Biyao Li, Stefan Steinerberger, Raghavendra Tripathi, and Ruimin Zhang, Finding structure in sequences of real numbers via graph theory: a problem list, arXiv:2012.04625, Dec 08, 2020
- N. J. A. Sloane, Graph of the first 1000 terms, showing the transition from chaos to order more dramatically.
- N. J. A. Sloane and Brady Haran, Amazing Graphs, Numberphile video (2019).
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,2,0,0,0,-1).
Crossrefs
Programs
-
Magma
a:=[1]; for n in [2..70] do if Gcd(a[n-1],n) eq 1 then Append(~a, a[n-1] + n + 1); else Append(~a, a[n-1] div Gcd(a[n-1],n)); end if; end for; [1] cat a; // Marius A. Burtea, Jan 12 2020
-
Maple
A[0]:= 1: A[1]:= 1: for n from 2 to 1000 do g:= igcd(A[n-1],n); A[n]:= A[n-1]/g + `if`(g=1, n+1, 0); od: seq(A[i],i=0..1000); # Robert Israel, Nov 06 2015
-
Mathematica
nxt[{n_,a_}]:={n+1,If[CoprimeQ[a,n+1],a+n+2,a/GCD[a,n+1]]}; Join[{1}, Transpose[ NestList[nxt,{1,1},70]][[2]]] (* Harvey P. Dale, Feb 14 2015 *)
-
PARI
(A133058_upto(N)=vector(N, n, if(gcd(N,n-1)>1 || n<3, N\=gcd(N,n-1), N+=n)))(100) \\ M. F. Hasler, Feb 15 2015, simplified Jan 11 2020
-
Python
from itertools import count, islice from math import gcd def A133058_gen(): # generator of terms a = 1 yield from (1,1) for n in count(2): yield (a:=a+n+1 if (b:=gcd(a,n)) == 1 else a//b) A133058_list = list(islice(A133058_gen(),30)) # Chai Wah Wu, Mar 18 2023
Extensions
More terms from Ctibor O. Zizka, Dec 26 2007
Offset and definition corrected by N. J. A. Sloane, Feb 13 2015
Comments