login
Composite numbers of the form k^2+k+1 all of whose prime factors are of that same form.
1

%I #30 May 27 2023 11:38:39

%S 21,91,273,343,507,651,1333,4557,6321,6643,27391,36673,50851,65793,

%T 83811,105301,139503,190533,194923,217623,234741,391251,545383,

%U 1647373,1961401,2032051,2376223,4517751,6118203,6484663,11590621,13180531,14535157,20155611,28371603,35646871

%N Composite numbers of the form k^2+k+1 all of whose prime factors are of that same form.

%H David A. Corneth, <a href="/A353056/b353056.txt">Table of n, a(n) for n = 1..318</a>

%H Cody S. Hansen and Pace P. Nielsen, <a href="https://arxiv.org/abs/2204.08971">Prime factors of phi3(x) of the same form</a>, arXiv:2204.08971 [math.NT], 2022.

%e 21 = 4^2+4+1 and its factors are 3 and 7, terms of A002383. So 21 is a term.

%p q:= n-> not isprime(n) and andmap(p-> issqr(4*p-3), numtheory[factorset](n)):

%p select(q, [k*(k+1)+1$k=4..6000])[]; # _Alois P. Heinz_, Apr 20 2022

%t Select[Table[n^2 + n + 1, {n, 1, 6000}], CompositeQ[#] && AllTrue[FactorInteger[#][[;; , 1]], IntegerQ@Sqrt[4*#1 - 3] &] &] (* _Amiram Eldar_, Apr 20 2022 *)

%o (PARI) lista(nn) = {for (n=1, nn, my(x=n^2+n+1); if (! isprime(x), my(fa=factor(x), ok=1); for (k=1, #fa~, my(fk=fa[k,1]); if (! issquare(4*fk-3), ok = 0);); if (ok, print1(x, ", "));););}

%o (Python)

%o from sympy import isprime, factorint

%o from itertools import count, takewhile

%o def agento(N): # generator of terms up to limit N

%o form = set(takewhile(lambda x: x<=N, (k**2 + k + 1 for k in count(1))))

%o for t in sorted(form):

%o if not isprime(t) and all(p in form for p in factorint(t)):

%o yield t

%o print(list(agento(10**8))) # _Michael S. Branicky_, Apr 20 2022

%Y Subsequence of A174969.

%Y Cf. A002383.

%K nonn

%O 1,1

%A _Michel Marcus_, Apr 20 2022