OFFSET
1,4
COMMENTS
a(n) is the least k such that 1^k + 2^k + 4^k is divisible by the n-th number for which such k exists.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(4) = 4 because A364722(4) = 13 and 1 + 2^4 + 4^4 = 273 = 21 * 13 is divisible by 13.
MAPLE
f:= proc(n) local R, r, m, v;
R:= map(t -> subs(t, x), [msolve(1+x+x^2, n)]);
m:= infinity;
for r in R do
try
v:= NumberTheory:-ModularLog(r, 2, n);
catch "no solutions exist": next
end try;
m:= min(m, v)
od;
subs(infinity=NULL, m);
end proc:
map(f, [seq(i, i=1..1000, 2)]);
PROG
(Python)
from itertools import count, islice
from sympy import sqrt_mod_iter, discrete_log
def A364724_gen(): # generator of terms
yield 0
for k in count(2):
m = None
for d in sqrt_mod_iter(-3, k):
r = d>>1 if d&1 else d+k>>1
try:
m = discrete_log(k, r, 2) if m is None else min(m, discrete_log(k, r, 2))
except:
continue
if m is not None: yield m
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Robert Israel, Aug 04 2023
STATUS
approved