A177186 a(n+1) = a(n) + p, where p is the largest prime dividing a(n) but not a(n-1), or 1 if there is no such prime.
1, 2, 4, 5, 10, 12, 15, 20, 22, 33, 36, 38, 57, 60, 65, 78, 81, 82, 123, 126, 133, 152, 154, 165, 170, 187, 198, 201, 268, 270, 275, 286, 299, 322, 329, 376, 378, 385, 396, 399, 418, 429, 442, 459, 462, 473, 516, 519, 692, 694, 1041, 1044, 1073, 1110, 1115, 1338
Offset: 1
Keywords
Examples
After a(9)=22, a(10)=33, the prime divisors of a(10) are 3 and 11; 11 divides 22, so p=3, and a(11)=36.
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
p[n1_, n2_] := If[pp = Complement[Transpose[FactorInteger[n2]][[1]], Transpose[FactorInteger[n1]][[1]]]; pp == {}, 1, Last[pp]]; a[1] = 1; a[2] = 2; a[n_] := a[n] = a[n-1] + p[a[n-2], a[n-1]]; Table[a[n], {n, 56}] (* Jean-François Alcover, Sep 02 2011 *) nxt[{a_,b_}]:={b,b+Max[1,Complement[FactorInteger[b][[All,1]],FactorInteger[ a] [[All,1]]]]}; NestList[nxt,{1,2},60][[All,1]] (* Harvey P. Dale, Dec 17 2022 *)
-
PARI
invec(v,x)=for(i=1,#v,if(v[i]==x,return(1)));0 lastnotin(vi,vx,dft)=forstep(i=#vi,1,-1,if(!invec(vx,vi[i]),return(vi[i])));dft al(n)=local(r);r=vector(n);r[1]=1;r[2]=2;for(k=3,n,r[k]=r[k-1]+lastnotin(factor(r[k-1])[,1]~,factor(r[k-2])[,1]~,1));r
Comments