A026422 a(n) = least positive integer > a(n-1) and not a(i)*a(j) for 1 <= i <= j < n.
1, 2, 3, 5, 7, 8, 11, 12, 13, 17, 18, 19, 20, 23, 27, 28, 29, 30, 31, 32, 37, 41, 42, 43, 44, 45, 47, 48, 50, 52, 53, 59, 61, 63, 66, 67, 68, 70, 71, 72, 73, 75, 76, 78, 79, 80, 83, 89, 92, 97, 98, 99, 101, 102, 103, 105, 107, 108, 109, 110
Offset: 1
Keywords
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..5000
Programs
-
Mathematica
a[1]=1; a[n_] := a[n] = (t= Union[Flatten[Table[a[i] a[j], {i, 1, n-1}, {j, i, n-1}]]]; Do[If[FreeQ[t, k], an = k; Break[]], {k, a[n-1]+1, Last[t]+1}]; an); Array[a, 60] (* Jean-François Alcover, May 06 2011 *) Select[Range[110], OddQ[Total[FactorInteger[#]][[2]]] &] (* T. D. Noe, May 07 2011 *) g = 110; t = Array[1 &, g]; Table[If[t[[j]] == 1, t[[j*i]] = 0, t[[i*j]] = 1], {j, 2, g/2}, {i, 2, g/j}]; Flatten[Position[t, 1]] (* Horst H. Manninger, Mar 15 2023 *)
-
PARI
is(n)=bigomega(n)%2 || n==1 \\ Charles R Greathouse IV, Sep 16 2015
-
Python
from math import prod, isqrt from sympy import primerange, primepi, integer_nthroot def A026422(n): def g(x,a,b,c,m): yield from (((d,) for d in enumerate(primerange(b,isqrt(x//c)+1),a)) if m==2 else (((a2,b2),)+d for a2,b2 in enumerate(primerange(b,integer_nthroot(x//c,m)[0]+1),a) for d in g(x,a2,b2,c*b2,m-1))) def f(x): return int(n+sum(sum(primepi(x//prod(c[1] for c in a))-a[-1][0] for a in g(x,0,1,1,m)) for m in range(2,x.bit_length()+1,2))) m, k = n, f(n) while m != k: m, k = k, f(k) return m # Chai Wah Wu, Apr 10 2025
Extensions
Name corrected by Charles R Greathouse IV, Sep 16 2015