%I #44 Jun 06 2017 23:28:32
%S 7,31,43,67,97,103,151,163,181,223,229,271,331,337,367,373,409,433,
%T 487,499,571,577,601,607,631,643,709,727,751,769,823,853,883,937,991,
%U 1009,1021,1033,1051,1063,1087,1117,1123,1231,1291,1297,1303
%N Ramanujan modulo primes R_(3,1)(n): a(n) is the smallest number such that if x >= a(n), then pi_(3,1)(x) - pi_(3,1)(x/2) >= n, where pi_(3,1)(x) is the number of primes==1 (mod 3) <= x.
%C All terms are primes==1 (mod 3).
%C A modular generalization of Ramanujan numbers, see Section 6 of the Shevelev-Greathouse-Moses paper.
%C We conjecture that for all n >= 1 a(n) <= A104272(3*n). This conjecture is based on observation that, if interval (x/2, x] contains >= 3*n primes, then at least n of them are of the form 3*k+1.
%C The function pi_(3,1)(n) starts 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,... with records occurring as specified in A123365/A002476. - _R. J. Mathar_, Jan 10 2013
%H G. C. Greubel, <a href="/A185004/b185004.txt">Table of n, a(n) for n = 1..1000</a>
%H Vladimir Shevelev, Charles R. Greathouse IV, Peter J. C. Moses, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL16/Moses/moses1.html">On intervals (kn, (k+1)n) containing a prime for all n>1</a>, Journal of Integer Sequences, Vol. 16 (2013), Article 13.7.3. <a href="http://arxiv.org/abs/1212.2785">arXiv:1212.2785</a>
%F lim(a(n)/prime(4*n)) = 1 as n tends to infinity.
%p pimod := proc(m,n,x)
%p option remember;
%p a := 0 ;
%p for k from n to x by m do
%p if isprime(k) then
%p a := a+1 ;
%p end if;
%p end do:
%p a ;
%p end proc:
%p a := [seq(0,n=1..100)] ;
%p for x from 1 do
%p pdiff := pimod(3,1,x)-pimod(3,1,x/2) ;
%p if pdiff+1 <= nops(a) then
%p v := x+1 ;
%p n := pdiff+1 ;
%p if n<v then
%p a := subsop(n=v,a) ;
%p print(a) ;
%p end if;
%p end if;
%p end do: # _R. J. Mathar_, Jan 10 2013
%t max = 100; pimod[m_, n_, x_] := pimod[m, n, x] = Module[{a = 0}, For[k = n, k <= x, k = k + m, If[PrimeQ[k], a = a + 1]]; a]; a[_] = 0; For[x = 1, x <= max^2, x++, pdiff = pimod[3, 1, x] - pimod[3, 1, x/2]; If[ pdiff + 1 <= max, v = x + 1; n = pdiff + 1; If[ n < v , a[n] = v ] ] ]; Table[a[n], {n, 1, max}] (* _Jean-François Alcover_, Jan 28 2013, translated and adapted from _R. J. Mathar_'s Maple program *)
%Y Cf. A104272, A185005, A185006, A185007.
%K nonn
%O 1,1
%A _Vladimir Shevelev_ and _Peter J. C. Moses_, Dec 18 2012