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.

A377758 a(n) is the least i such that 2n-prime(i) is also a prime, where prime(i) is the i-th prime.

This page as a plain text file.
%I A377758 #24 Nov 20 2024 07:18:24
%S A377758 1,2,2,2,3,2,2,3,2,2,3,2,3,4,2,2,3,4,2,3,2,2,3,2,3,4,2,3,4,2,2,3,4,2,
%T A377758 3,2,2,3,4,2,3,2,3,4,2,3,4,8,2,3,2,2,3,2,2,3,2,3,4,6,5,6,8,2,3,2,3,4,
%U A377758 2,2,3,4,5,5,2,2,3,4,2,3,4,2,3,2,3
%N A377758 a(n) is the least i such that 2n-prime(i) is also a prime, where prime(i) is the i-th prime.
%H A377758 Robert Israel, <a href="/A377758/b377758.txt">Table of n, a(n) for n = 2..10000</a>
%F A377758 a(n) = pi(A020481(n)).
%p A377758 f:= proc(n) local i,p;
%p A377758   p:= 1:
%p A377758   for i from 1 do
%p A377758     p:= nextprime(p);
%p A377758     if isprime(2*n-p) then return i fi
%p A377758   od
%p A377758 end proc:
%p A377758 map(f, [$2..100]); # _Robert Israel_, Nov 19 2024
%t A377758 Table[Module[{i = 1}, While[i <= PrimePi[n] && ! PrimeQ[n - Prime[i]], i++]; If[i <= PrimePi[n], i, None]], {n, 4, 1000, 2}]
%o A377758 (PARI) a(n) = my(i=1); while (!isprime(2*n-prime(i)), i++); i; \\ _Michel Marcus_, Nov 06 2024
%o A377758 (Python)
%o A377758 from sympy import primerange, isprime
%o A377758 def A377758(n): return next(i for i, p in enumerate(primerange(2*n),1) if isprime((n<<1)-p)) # _Chai Wah Wu_, Nov 19 2024
%Y A377758 Cf. A000040, A000720, A020481, A377972.
%K A377758 nonn
%O A377758 2,2
%A A377758 _Michel Eduardo Beleza Yamagishi_, Nov 06 2024