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.

Showing 1-1 of 1 results.

A365275 Number of integers k <= n that can be written as k = m^2+p^2 where p is a prime and m is a positive integer.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 6, 7, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 19, 20, 21, 21, 21, 21, 21, 21, 21
Offset: 1

Views

Author

Michel Marcus, Aug 30 2023

Keywords

Crossrefs

Cf. A361300.

Programs

  • Mathematica
    a={}; For[n=1, n<=80, n++, nk=0;  For[k=1, k<=n, k++, flag=1; For[m=1, m<=Sqrt[k]&&flag==1, m++, sp=Sqrt[k-m^2]; If[IntegerQ[sp^2]&&PrimeQ[sp], nk++; flag=0]]]; AppendTo[a,nk]]; a (* Stefano Spezia, Aug 30 2023 *)
  • PARI
    isok(k) = my(q); for(i=1, sqrtint(k), if (issquare(q=k-i^2) && isprime(sqrtint(q)), return(1))); return(0);
    a(n) = sum(k=1, n, isok(k));
Showing 1-1 of 1 results.