cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

21, 91, 273, 343, 507, 651, 1333, 4557, 6321, 6643, 27391, 36673, 50851, 65793, 83811, 105301, 139503, 190533, 194923, 217623, 234741, 391251, 545383, 1647373, 1961401, 2032051, 2376223, 4517751, 6118203, 6484663, 11590621, 13180531, 14535157, 20155611, 28371603, 35646871
Offset: 1

Views

Author

Michel Marcus, Apr 20 2022

Keywords

Examples

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

Crossrefs

Subsequence of A174969.
Cf. A002383.

Programs

  • Maple
    q:= n-> not isprime(n) and andmap(p-> issqr(4*p-3), numtheory[factorset](n)):
    select(q, [k*(k+1)+1$k=4..6000])[];  # Alois P. Heinz, Apr 20 2022
  • Mathematica
    Select[Table[n^2 + n + 1, {n, 1, 6000}], CompositeQ[#] && AllTrue[FactorInteger[#][[;; , 1]], IntegerQ@Sqrt[4*#1 - 3] &] &] (* Amiram Eldar, Apr 20 2022 *)
  • 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, ", "));););}
    
  • Python
    from sympy import isprime, factorint
    from itertools import count, takewhile
    def agento(N): # generator of terms up to limit N
        form = set(takewhile(lambda x: x<=N, (k**2 + k + 1 for k in count(1))))
        for t in sorted(form):
            if not isprime(t) and all(p in form for p in factorint(t)):
                yield t
    print(list(agento(10**8))) # Michael S. Branicky, Apr 20 2022