login
Numbers with at most 2 prime factors (counted with multiplicity).
68

%I #56 Aug 24 2024 05:56:08

%S 1,2,3,4,5,6,7,9,10,11,13,14,15,17,19,21,22,23,25,26,29,31,33,34,35,

%T 37,38,39,41,43,46,47,49,51,53,55,57,58,59,61,62,65,67,69,71,73,74,77,

%U 79,82,83,85,86,87,89,91,93,94,95,97,101,103,106,107,109,111,113,115,118

%N Numbers with at most 2 prime factors (counted with multiplicity).

%C A001222(a(n)) <= 2; A054576(a(n)) = 1. - _Reinhard Zumkeller_, Mar 10 2006

%C Products of two noncomposite numbers. - _Juri-Stepan Gerasimov_, Apr 15 2010

%C Also, numbers with permutations of all divisors only with coprime adjacent elements: A109810(a(n)) > 0. - _Reinhard Zumkeller_, May 24 2010

%C A060278(a(n)) = 0. - _Reinhard Zumkeller_, Apr 05 2013

%C 1 together with numbers k such that sigma(k) + phi(k) - d(k) = 2k - 2. - _Wesley Ivan Hurt_, May 03 2015

%C Products of two not necessarily distinct terms of A008578 (the same relation between A000040 and A001358). - _Flávio V. Fernandes_, May 28 2021

%H Felix Fröhlich, <a href="/A037143/b037143.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from Reinhard Zumkeller)

%H Andreas Weingartner, <a href="https://arxiv.org/abs/2303.16819">Uniform distribution of alpha*n modulo one for a family of integer sequences</a>, arXiv:2303.16819 [math.NT], 2023.

%p with(numtheory): A037143:=n->`if`(bigomega(n)<3,n,NULL): seq(A037143(n), n=1..200); # _Wesley Ivan Hurt_, May 03 2015

%t Select[Range[120], PrimeOmega[#] <= 2 &] (* _Ivan Neretin_, Aug 16 2015 *)

%o (Haskell)

%o a037143 n = a037143_list !! (n-1)

%o a037143_list = 1 : merge a000040_list a001358_list where

%o merge xs'@(x:xs) ys'@(y:ys) =

%o if x < y then x : merge xs ys' else y : merge xs' ys

%o -- _Reinhard Zumkeller_, Dec 18 2012

%o (PARI) is(n)=bigomega(n)<3 \\ _Charles R Greathouse IV_, Apr 29 2015

%o (Python)

%o from math import isqrt

%o from sympy import primepi, primerange

%o def A037143(n):

%o def f(x): return int(n-2+x-primepi(x)-sum(primepi(x//k)-a for a,k in enumerate(primerange(isqrt(x)+1))))

%o kmin, kmax = 1,2

%o while f(kmax) >= kmax:

%o kmax <<= 1

%o while True:

%o kmid = kmax+kmin>>1

%o if f(kmid) < kmid:

%o kmax = kmid

%o else:

%o kmin = kmid

%o if kmax-kmin <= 1:

%o break

%o return kmax # _Chai Wah Wu_, Aug 23 2024

%Y Union of A008578 and A001358. Complement of A033942.

%Y Cf. A063928, A001222, A054576, A109810, A060278.

%Y A101040(a(n))=1 for n>1.

%Y Subsequence of A037144. - _Reinhard Zumkeller_, May 24 2010

%Y A098962 and A139690 are subsequences.

%K nonn

%O 1,2

%A _N. J. A. Sloane_

%E More terms from _Henry Bottomley_, Aug 15 2001