login
Let k be the smallest k such that the square root of k*n rounds to a prime number; a(n) is this prime number.
1

%I #13 Oct 19 2022 12:59:02

%S 2,2,2,2,2,2,3,3,3,3,3,3,5,5,5,7,7,7,11,11,5,5,5,5,5,5,5,5,5,5,11,11,

%T 11,13,13,13,11,11,11,11,11,11,7,7,7,7,7,7,7,7,7,7,7,7,7,7,11,11,11,

%U 11,11,11,11,11,11,11,23,23,17,17,17,17,17,17,17,17

%N Let k be the smallest k such that the square root of k*n rounds to a prime number; a(n) is this prime number.

%C This sequence gives the prime numbers associated with A357477.

%C The sequence is well defined as for any prime number p >= n/2, A000194 contains n or more consecutive p's, and so a(n) <= p.

%H Rémy Sigrist, <a href="/A357899/b357899.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = round(sqrt(A357477(n) * n)).

%e For n = 19:

%e - we have:

%e k round(sqrt(k*19)) prime?

%e - ----------------- ------

%e 1 4 No

%e 2 6 No

%e 3 8 No

%e 4 9 No

%e 5 10 No

%e 6 11 Yes

%e - so a(19) = 11.

%o (PARI) a(n) = my (p); for (k=1, oo, if (isprime(p=round(sqrt(k*n))), return (p)))

%o (Python)

%o from math import isqrt

%o from itertools import count

%o from sympy import isprime

%o def A357899(n): return next(filter(isprime, ((m:=isqrt(k*n))+ int((k*n-m*(m+1)<<2)>=1) for k in count(1)))) # _Chai Wah Wu_, Oct 19 2022

%Y Cf. A000194, A308052, A357477 (corresponding k's).

%K nonn

%O 1,1

%A _Rémy Sigrist_, Oct 19 2022