A055041 - OEIS (original) (raw)

3, 12, 21, 27, 30, 39, 48, 57, 66, 75, 84, 93, 102, 108, 111, 120, 129, 138, 147, 156, 165, 174, 183, 189, 192, 201, 210, 219, 228, 237, 243, 246, 255, 264, 270, 273, 282, 291, 300, 309, 318, 327, 336, 345, 351, 354, 363, 372, 381, 390, 399

COMMENTS

The numbers not of the form x^2+y^2+6z^2.

Numbers whose squarefree part is congruent to 3 modulo 9. Compare with A329575. - Peter Munn, May 17 2020

The asymptotic density of this sequence is 1/8. - Amiram Eldar, Mar 08 2021

MATHEMATICA

f[p_, e_] := (p^Mod[e, 2]); sqfpart[n_] := Times @@ f @@@ FactorInteger[n]; Select[Range[400], Mod[sqfpart[#], 9] == 3 &] (* Amiram Eldar, Mar 08 2021 *)

PROG

(Python)

from sympy import integer_log

def bisection(f, kmin=0, kmax=1):

while f(kmax) > kmax: kmax <<= 1

kmin = kmax >> 1

while kmax-kmin > 1:

kmid = kmax+kmin>>1

if f(kmid) <= kmid:

kmax = kmid

else:

kmin = kmid

return kmax

def f(x): return n+x-sum((x//9**i-1)//3+1 for i in range(integer_log(x, 9)[0]+1))

return bisection(f, n, n)*3 # Chai Wah Wu, Feb 14 2025