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.

A360789 Least prime p such that p mod primepi(p) = n.

This page as a plain text file.
%I A360789 #27 Mar 19 2023 03:40:54
%S A360789 2,3,5,7,379,23,401,61,59,29,67,71,467,79,83,179,431,89,176557,191,
%T A360789 24419,491,97,101,499,1213,3169,3191,523,229,3187,223,3203,8609,3163,
%U A360789 251,176509,257,24509,263,3253,269,547,3347,1304867,293
%N A360789 Least prime p such that p mod primepi(p) = n.
%C A360789 Inspired by A048891.
%H A360789 Robert G. Wilson v, <a href="/A360789/b360789.txt">Table of n, a(n) for n = 0..19217</a>
%F A360789 a(n) = prime(A073325(n+1)). - _Kevin Ryde_, Feb 21 2023
%e A360789 For n=0, prime p=2 has p mod primepi(p) = 2 mod 1 = 0 so that a(0) = 2.
%e A360789 For n=4, no prime has p mod primepi(p) = 4 until reaching p=379 which is 379 mod 75 = 4, so that a(4) = 379.
%p A360789 V:= Array(0..100): count:= 0:
%p A360789 p:= 1:
%p A360789 for k from 1 while count < 101 do
%p A360789   p:= nextprime(p);
%p A360789   v:= p mod k;
%p A360789   if v <= 100 and V[v] = 0 then V[v]:= p; count:= count+1 fi;
%p A360789 od:
%p A360789 convert(V,list); # _Robert Israel_, Feb 28 2023
%t A360789 t[_] := 0; p = 2; pi = 1; While[p < 1400000, m = Mod[p, pi]; If[m < 100 && t[m] == 0, t[m] = p]; p = NextPrime@p; pi++]; t /@ Range[0, 99]
%o A360789 (PARI) a(n)={my(k=n); forprime(p=prime(n+1), oo, k++; if(p%k ==n, return(p)))} \\ _Andrew Howroyd_, Feb 21 2023
%o A360789 (Python)
%o A360789 from sympy import prime, nextprime
%o A360789 def A360789(n):
%o A360789     p, m = prime(n+1), n+1
%o A360789     while p%m != n:
%o A360789         p = nextprime(p)
%o A360789         m += 1
%o A360789     return p # _Chai Wah Wu_, Mar 18 2023
%Y A360789 Cf. A038625, A004648, A048891, A052013, A073325, A073436, A162567, A171430, A171431, A171432, A171434.
%K A360789 nonn
%O A360789 0,1
%A A360789 _Robert G. Wilson v_, Feb 20 2023