OFFSET
1,1
COMMENTS
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = round(sqrt(A357477(n) * n)).
EXAMPLE
For n = 19:
- we have:
k round(sqrt(k*19)) prime?
- ----------------- ------
1 4 No
2 6 No
3 8 No
4 9 No
5 10 No
6 11 Yes
- so a(19) = 11.
PROG
(PARI) a(n) = my (p); for (k=1, oo, if (isprime(p=round(sqrt(k*n))), return (p)))
(Python)
from math import isqrt
from itertools import count
from sympy import isprime
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
CROSSREFS
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Oct 19 2022
STATUS
approved