cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A255854 Least k > 0 such that gcd(k^n+4, (k+1)^n+4) > 1, or 0 if there is no such k.

This page as a plain text file.
%I A255854 #32 May 09 2024 10:58:52
%S A255854 1,0,8,210,1,82,128,4763358550,1,22,8,4050643070777669523228,1,
%T A255854 1010633974733,7784,100,1,26627469676193276478340,8,179,1,4082,48,
%U A255854 1293523748876425462850,1,173,8,5,1,2423,320,342,1,1162,8,93,1,455207,128,22,1,11383,8,58768,1,91,96,306824898,1,187751,8,84,1
%N A255854 Least k > 0 such that gcd(k^n+4, (k+1)^n+4) > 1, or 0 if there is no such k.
%C A255854 See A118119, which is the main entry for this class of sequences.
%F A255854 a(4k)=1, a(8k+2)=8 (k>=0), cf. examples.
%e A255854 For n=1, gcd(k^n+4, (k+1)^n+4) = gcd(k+4, k+5) = 1, therefore a(1)=0.
%e A255854 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.
%e A255854 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).
%e A255854 Also a(4k)=1, because gcd(1^(4k)+4, 2^(4k)+4) = gcd(5, 16^k-1) = 5.
%t A255854 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 *)
%o A255854 (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))}
%o A255854 (Python)
%o A255854 from sympy import primefactors, resultant, nthroot_mod
%o A255854 from sympy.abc import x
%o A255854 def A255854(n):
%o A255854     if n == 0: return 1
%o A255854     k = 0
%o A255854     for p in primefactors(resultant(x**n+4,(x+1)**n+4)):
%o A255854         for d in (a for a in sorted(nthroot_mod(-4,n,p,all_roots=True)) if pow(a+1,n,p)==-4%p):
%o A255854             k = min(d,k) if k else d
%o A255854             break
%o A255854     return int(k) # _Chai Wah Wu_, May 08 2024
%Y A255854 Cf. A118119, A255832.
%Y A255854 Cf. A255852, A255853, A255855, A255856, A255857, A255858, A255869.
%K A255854 nonn
%O A255854 0,3
%A A255854 _M. F. Hasler_, Mar 08 2015
%E A255854 a(7)-a(46) from _Hiroaki Yamanouchi_, Mar 13 2015
%E A255854 a(47)-a(52) from _Max Alekseyev_, Aug 06 2015