login
A357477
a(n) is the smallest k such that the square root of k*n rounds to a prime.
4
3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 5, 5, 5, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 8, 8, 4, 4, 4, 4, 4, 4, 4, 4, 7, 7, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3
OFFSET
1,1
LINKS
EXAMPLE
a(19) = 6 because sqrt(19*6) rounded to the nearest integer is 11, which is prime. Any multiple smaller than this only rounds to a composite number.
MATHEMATICA
Array[(k = 1; While[! PrimeQ[Round@ Sqrt[k #]], k++]; k) &, 105] (* Michael De Vlieger, Oct 19 2022 *)
PROG
(PARI) a(n) = my(k=1); while (!isprime(round(sqrt(k*n))), k++); k; \\ Michel Marcus, Oct 18 2022
(Python)
from math import isqrt
from itertools import count
from sympy import isprime
def A357477(n): return next(filter(lambda k:isprime((m:=isqrt(k*n))+ int((k*n-m*(m+1)<<2)>=1)), count(1))) # Chai Wah Wu, Oct 19 2022
CROSSREFS
Sequence in context: A355693 A318291 A251482 * A172083 A337199 A344879
KEYWORD
nonn,easy
AUTHOR
Jake M. Gotlieb, Sep 30 2022
STATUS
approved