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.

A205506 Least positive integer m > 1 such that 1 - m^k + m^(2*k) is prime, where k=A003586(n).

This page as a plain text file.
%I A205506 #37 Oct 23 2024 00:43:18
%S A205506 2,2,6,2,3,5,7,3,4,3,6,93,2,88,5,33,5,196,15,106,174,196,14,342,207,
%T A205506 28,372,14,47,25,569,646,141,129,278,5,421,224,629,26,424,1081,688,
%U A205506 246,736,4392,124,484,759,791,4401,863,2854,410,1044,22,848,1402,2006
%N A205506 Least positive integer m > 1 such that 1 - m^k + m^(2*k) is prime, where k=A003586(n).
%C A205506 1 - m^k + m^(2*k) equals Phi(6*k,m) when k=2^p*3^q, p>=0, q>=0, which may be prime numbers for certain positive integer m>1.
%C A205506 The Mathematica program given here generates the first 33 terms.  Further terms were generated by OpenPFGW.
%C A205506 a(62)=7426, while A003586(62)=3^8=6561.
%F A205506 a(n) = A085398(6*A003586(n)). - _Jinyuan Wang_, Jan 01 2023
%F A205506 a(n) is smallest positive m such that Phi(A033845(n),m) is prime. - _Chai Wah Wu_, Sep 16 2024
%e A205506 n=1, A003586(1)=1, when m=2, 1-2^1+2^2=3 is prime, so a(1)=2;
%e A205506 n=2, A003586(2)=2, when m=2, 1-2^2+2^4=13 is prime, so a(2)=2;
%e A205506 ...
%e A205506 n=7, A003586(7)=9, when m=7, 1-7^9+7^18=1628413557556843 is prime, so a(7)=7.
%t A205506 fQ[n_] := n == 3 EulerPhi@n; a = Select[6 Range@500, fQ]/6; l =
%t A205506 Length[a]; Table[m = a[[j]]; i = 1;
%t A205506 While[i++; cp = 1 - i^m + i^(2*m); ! PrimeQ[cp]]; i, {j, 1, l}]
%o A205506 (Python)
%o A205506 from itertools import count
%o A205506 from sympy import isprime, integer_log
%o A205506 def A205506(n):
%o A205506     def bisection(f,kmin=0,kmax=1):
%o A205506         while f(kmax) > kmax: kmax <<= 1
%o A205506         while kmax-kmin > 1:
%o A205506             kmid = kmax+kmin>>1
%o A205506             if f(kmid) <= kmid:
%o A205506                 kmax = kmid
%o A205506             else:
%o A205506                 kmin = kmid
%o A205506         return kmax
%o A205506     def f(x): return n+x-sum((x//3**i).bit_length() for i in range(integer_log(x,3)[0]+1))
%o A205506     k = bisection(f,n,n)
%o A205506     return next(filter(lambda m:isprime(1-m**k+m**(k<<1)),count(2))) # _Chai Wah Wu_, Oct 22 2024
%Y A205506 Cf. A003586, A033845, A056993, A085398, A153438.
%K A205506 nonn,hard
%O A205506 1,1
%A A205506 _Lei Zhou_, Feb 01 2012