%I #34 May 09 2024 10:58:48
%S 1,0,1,5,1,533360,1,55,1,7,1,796479131355665831357,1,41,1,5,1,3775,1,
%T 42296,1,7,1,653246700175064613889,1,21,1,5,1,1619,1,42842,1,7,1,2945,
%U 1,323371,1,5,1,1102221,1,633524110177,1,7,1
%N Least k > 0 such that gcd(k^n+5, (k+1)^n+5) > 1, or 0 if there is no such k.
%C See A118119, which is the main entry for this class of sequences.
%F a(2k)=1 for k>=0, because gcd(1^(2k)+5,2^(2k)+5) = gcd(6,4^k-1) = 3.
%e For n=1, gcd(k^n+5, (k+1)^n+5) = gcd(k+5, k+6) = 1, therefore a(1)=0.
%e For n=2k, see formula.
%e For n=3, we have gcd(5^3+5, 6^3+5) = 13, and the pair (k,k+1)=(5,6) is the smallest which yields a GCD > 1, therefore a(3)=5.
%t A255855[n_] := Module[{m = 1}, While[GCD[m^n + 5, (m + 1)^n + 5] <= 1, m++]; m]; Join[{1, 0}, Table[A255855[n], {n, 2, 10}]]
%o (PARI) a(n,c=5,L=10^7,S=1)->for(a=S,L,gcd(a^n+c,(a+1)^n+c)>1&&return(a))
%o (Python)
%o from sympy import primefactors, resultant, nthroot_mod
%o from sympy.abc import x
%o def A255855(n):
%o if n == 0: return 1
%o k = 0
%o for p in primefactors(resultant(x**n+5,(x+1)**n+5)):
%o for d in (a for a in sorted(nthroot_mod(-5,n,p,all_roots=True)) if pow(a+1,n,p)==-5%p):
%o k = min(d,k) if k else d
%o break
%o return int(k) # _Chai Wah Wu_, May 08 2024
%Y Cf. A118119, A255832.
%Y Cf. A255852, A255853, A255854, A255856, A255857, A255858, A255869.
%K nonn,hard
%O 0,4
%A _M. F. Hasler_, Mar 08 2015
%E a(11)-a(46) from _Hiroaki Yamanouchi_, Mar 12 2015
|