login
A372494
For n >= 1, a(n) is the least k >= 0 such that k^2 + k + 1 is divisible by 2^n - 1 or a(n) = -1 if no such k exists.
1
0, 1, 2, -1, 5, -1, 19, -1, 81, -1, -1, -1, 90, 1885, 4799, -1, 21905, -1, 69492, -1, 99206, -1, -1, -1, 585398, 8985436, 32569980, -1, -1, -1, 634005911, -1, -1, -1, -1, -1, 7348910325, 40154162248, 28169995830, -1, -1, -1, -1, -1, 749259285289, -1, -1, -1, 22640169503650
OFFSET
1,3
LINKS
EXAMPLE
n = 5: (k^2 + k + 1) / (2^5 - 1) is true for the least k = 5, thus a(5) = 5.
n = 7: (k^2 + k + 1) / (2^7 - 1) is true for the least k = 19, thus a(7) = 19.
PROG
(Python)
from sympy import sqrt_mod_iter
def A372494(n):
k = (1<<n)-1
k2 = k>>1
return min((d>>1 if d&1 else (d>>1)+k2 for d in sqrt_mod_iter(-3, k)), default=-1) # Chai Wah Wu, May 03 2024
CROSSREFS
Sequence in context: A173111 A363739 A257459 * A140879 A006556 A108790
KEYWORD
sign
AUTHOR
Ctibor O. Zizka, May 03 2024
STATUS
approved