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.

A160373 Smallest number m such that exactly n triples (p,q,r) of distinct primes exist with m=p*q+r.

This page as a plain text file.
%I A160373 #8 Mar 09 2018 02:48:22
%S A160373 1,11,13,23,17,37,53,62,81,99,93,105,118,122,148,152,165,166,208,224,
%T A160373 214,225,232,250,284,285,308,314,332,346,326,382,388,400,448,476,458,
%U A160373 494,454,518,520,478,525,530,578,598,640,602,632,716,634,740,710,692
%N A160373 Smallest number m such that exactly n triples (p,q,r) of distinct primes exist with m=p*q+r.
%C A160373 A100951(a(n)) = n and A100951(m) <> n for m < a(n);
%C A160373 a(42) = 525 seems to be the largest odd term.
%C A160373 Note that switching p and q does not make a different triple. - _Robert Israel_, Mar 09 2018
%H A160373 Robert Israel, <a href="/A160373/b160373.txt">Table of n, a(n) for n = 0..6567</a> (n=0..500 from Reinhard Zumkeller)
%e A160373 A100951(37) = #{2*3+31,2*7+23,2*13+11,2*17+3,5*7+2} = 5.
%p A160373 N:= 10^4: # to get terms before the first term > N
%p A160373 Primes:= select(isprime, [2, seq(i,i=3..N,2)]):
%p A160373 V:= Vector(N):
%p A160373 for r in Primes do
%p A160373   for j from 1 while Primes[j]^2 <= N do
%p A160373     p:= Primes[j];
%p A160373     if p = r then next fi;
%p A160373     for k from j+1 while p*Primes[k]+r <= N do
%p A160373       q:= Primes[k];
%p A160373       if q = r then next fi;
%p A160373       V[p*q+r]:= V[p*q+r]+1;
%p A160373     od
%p A160373   od
%p A160373 od:
%p A160373 mv:= max( V):
%p A160373 F:= Vector(mv):
%p A160373 for i from 1 to N do
%p A160373   if V[i] > 0 and F[V[i]] = 0 then F[V[i]]:= i fi
%p A160373 od:
%p A160373 F0:= min(select(t -> F[t] = 0, [$1..max(V)])):
%p A160373 1, seq(F[i],i=1..F0-1); # _Robert Israel_, Mar 09 2018
%p A160373 N:= 10^4: # to get terms before the first term > N
%p A160373 Primes:= select(isprime, [2, seq(i,i=3..N,2)]):
%p A160373 V:= Vector(N):
%p A160373 for r in Primes do
%p A160373   for j from 1 while Primes[j]^2 <= N do
%p A160373     p:= Primes[j];
%p A160373     if p = r then next fi;
%p A160373     for k from j+1 to nops(Primes) while p*Primes[k]+r <= N do
%p A160373       q:= Primes[k];
%p A160373       if q = r then next fi;
%p A160373       V[p*q+r]:= V[p*q+r]+1;
%p A160373     od
%p A160373   od
%p A160373 od:
%p A160373 mv:= max( V):
%p A160373 F:= Vector(mv):
%p A160373 for i from 1 to N do
%p A160373   if V[i] > 0 and F[V[i]] = 0 then F[V[i]]:= i fi
%p A160373 od:
%p A160373 F0:= min(select(t -> F[t] = 0, [$1..max(V)])):
%p A160373 if F0 = infinity then F0:= mv fi:
%p A160373 1, seq(F[i],i=1..F0-1); # _Robert Israel_, Mar 09 2018
%K A160373 nonn
%O A160373 0,2
%A A160373 _Reinhard Zumkeller_, May 11 2009