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.

A255769 Primes p such that there are a prime number of composite numbers less than p.

Original entry on oeis.org

7, 11, 23, 31, 47, 59, 67, 83, 97, 109, 137, 149, 167, 179, 197, 211, 233, 269, 331, 347, 353, 367, 389, 419, 431, 439, 587, 617, 739, 751, 829, 859, 907, 919, 977, 991, 1009, 1031, 1039, 1063, 1117, 1171, 1187, 1237, 1319, 1327, 1427, 1447, 1471, 1499, 1553, 1567, 1723, 1901, 1913, 1933, 2207, 2221, 2269, 2293, 2333
Offset: 1

Views

Author

Antonio Gimenez, Jul 11 2015

Keywords

Examples

			There are two composite numbers less than 7, namely, 4 and 6, and 2 is prime. Therefore 7 is a member of the sequence.
		

Crossrefs

Cf. A072677.

Programs

  • Maple
    c:= proc(n) option remember; `if`(n<4, 0,
          c(n-1)+`if`(isprime(n-1), 0, 1))
        end:
    a:= proc(n) option remember; local p;
          p:= `if`(n=1, 1, a(n-1));
          do p:= nextprime(p);
             if isprime(c(p)) then break fi
          od; p
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Jul 23 2015
  • Mathematica
    fQ[n_]:=PrimeQ[n-PrimePi[n]-1];Select[Prime[Range@400],fQ[#]&] (* Ivan N. Ianakiev, Jul 12 2015 *)
  • PARI
    is_ok(n)=my(i,k=0); for(i=2,n-1,if(bigomega(i)>1,k++)); isprime(k)&&isprime(n);
    first(m)=my(i=1,v=vector(m),k=0);while(i<=m,if(is_ok(k), v[i]=k;i++);k++);v; \\ Anders Hellström, Jul 29 2015
    
  • PARI
    listp(nn)=forprime(p=2, nn, if (isprime(p - primepi(p) - 1), print1(p, ", "));); \\ Michel Marcus, Aug 27 2016
    
  • PARI
    list(lim)=my(v=List(),n=1); forprime(p=2,lim, if(isprime(p - n++), listput(v,p))); Vec(v) \\ Charles R Greathouse IV, Aug 28 2016

Extensions

a(16)-a(61) from Ivan N. Ianakiev, Jul 12 2015