A304752 Beginning with a(1) = 1, for n > 1, a(n) = the least divisor of a(n-1) not included earlier, otherwise a(n) = the least multiple m*a(n-1) such that m is not a divisor of a(n-1) and m*a(n-1) is not included earlier.
1, 2, 6, 3, 12, 4, 20, 5, 10, 30, 15, 60, 420, 7, 14, 42, 21, 84, 28, 140, 35, 70, 210, 105, 630, 9, 18, 72, 8, 24, 120, 40, 240, 16, 48, 336, 56, 168, 840, 280, 1680, 80, 480, 32, 96, 672, 112, 560, 3360, 160, 960, 64, 192, 1344, 224, 1120, 6720, 320, 1920, 128, 384, 2688, 448, 2240, 13440, 640, 3840, 256, 768, 5376, 896, 4480, 26880, 1280, 7680, 512
Offset: 1
Keywords
Examples
After a(27) = 18 = 2 * 3^2, the next term a(28) is neither 2*18 = 2^2 * 3^2, nor 3*18 = 2 * 3^3 as both 2 and divide 18. But 4 does not divide 18, and 4*18 = 72 haven't yet been used in the sequence, thus a(28) = 72.
Links
- Antti Karttunen & Michael De Vlieger, Table of n, a(n) for n = 1..16384
Crossrefs
Programs
-
Maple
lim:=60: with(numtheory): membera := proc(val) global a, n: local j: for j from 1 to n-1 do if(a[j]=val)then return true: fi: od: return false: end: a[1]:=1:for n from 2 to lim do d:=sort([divisors(a[n-1])[]]): s:=true: for k from 1 to nops(d) do if(not membera(d[k]))then a[n]:=d[k]:s:=false: break:fi:od: if(s)then for j from 2 do if(not member(j, d) and not membera(j*a[n-1]))then a[n]:=j*a[n-1]:break: fi:od:fi:od: seq(a[n], n=1..lim); # Nathaniel Johnston, May 10 2011, given originally for A113552 # second Maple program: b:= proc(n) is(n=1) end: a:= proc(n) option remember; local j, l, i, m; j:= a(n-1): l:= sort([numtheory[divisors](j)[]]); for i to nops(l) do if not b(l[i]) then b(l[i]):=true; return l[i] fi od; for m while m in l or b(m*j) do od; b(m*j):=true; m*j end: a(1):=1: seq(a(n), n=1..100); # Alois P. Heinz, May 22 2018
-
Mathematica
f[s_] := Append[s, d = Divisors[ s[[ -1]]]; If[ Complement[d, s] != {}, Complement[d, s][[1]], k = 2; While[ Mod[ s[[ -1]], k] == 0 || MemberQ[s, k*s[[ -1]]], k++ ]; k*s[[ -1]] ]]; Nest[f, {1}, 60] (* Robert G. Wilson v, Aug 20 2006, given originally for A113552 *)
-
PARI
up_to = (2^14)+1; v304752 = vector(up_to); m_occurrences = Map(); k=0; prev=1; for(n=1,up_to,fordiv(prev,d,if(!mapisdefined(m_occurrences,d),v304752[n] = d;mapput(m_occurrences,d,n);break)); if(!v304752[n], m = 1; try = prev; while(!(prev%m) || mapisdefined(m_occurrences,try), m++; try = prev*m); mapput(m_occurrences,v304752[n] = try,n)); prev = v304752[n]); A304752(n) = v304752[n];
-
PARI
A304752(n,a=1,list=List(a)/*set to 0 to get just a(n)*/,U=[])={ for(i=2,n, U=setunion(U,[a]); fordiv(a,d,setsearch(U,d)||[a=-d,break]); if(a>0, for(m=2,oo, a%m && !setsearch(U,m*a)&& (a*=m)&& break),a=-a);list&& listput(list,a); /*a%2&&printf("a(%d)=%d, ",i,a)*/);if(list,list,a)} \\ M. F. Hasler, Dec 26 2020
Comments