OFFSET
0,3
COMMENTS
See A118119, which is the main entry for this class of sequences.
FORMULA
a(4k)=1, a(8k+2)=8 (k>=0), cf. examples.
EXAMPLE
For n=1, gcd(k^n+4, (k+1)^n+4) = gcd(k+4, k+5) = 1, therefore a(1)=0.
For n=2, we have gcd(8^2+4, 9^2+4) = gcd(68, 85) = 17, and the pair (k,k+1)=(8,9) is the smallest with this property, therefore a(2)=8.
More generally, a(8k+2)=8 because gcd(8^(8k+2)+4, 9^(8k+2)+4) = gcd(64^(4k+1)+4, 81^(4k+1)+4) >= 17, since 64 = 81 = 13 (mod 17) and 13^4 = 1 (mod 17).
Also a(4k)=1, because gcd(1^(4k)+4, 2^(4k)+4) = gcd(5, 16^k-1) = 5.
MATHEMATICA
A255854[n_] := Module[{m = 1}, While[GCD[m^n + 4, (m + 1)^n + 4] <= 1, m++]; m]; Join[{1, 0}, Table[A255854[n], {n, 2, 6}]] (* Robert Price, Oct 15 2018 *)
PROG
(PARI) a(n, c=4, L=10^6, S=1)={n!=1 && for(a=S, L, gcd(a^n+c, (a+1)^n+c)>1&&return(a))}
(Python)
from sympy import primefactors, resultant, nthroot_mod
from sympy.abc import x
def A255854(n):
if n == 0: return 1
k = 0
for p in primefactors(resultant(x**n+4, (x+1)**n+4)):
for d in (a for a in sorted(nthroot_mod(-4, n, p, all_roots=True)) if pow(a+1, n, p)==-4%p):
k = min(d, k) if k else d
break
return int(k) # Chai Wah Wu, May 08 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Mar 08 2015
EXTENSIONS
a(7)-a(46) from Hiroaki Yamanouchi, Mar 13 2015
a(47)-a(52) from Max Alekseyev, Aug 06 2015
STATUS
approved