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.

A138929 Twice the prime powers A000961.

This page as a plain text file.
%I A138929 #37 Aug 30 2024 10:18:35
%S A138929 2,4,6,8,10,14,16,18,22,26,32,34,38,46,50,54,58,62,64,74,82,86,94,98,
%T A138929 106,118,122,128,134,142,146,158,162,166,178,194,202,206,214,218,226,
%U A138929 242,250,254,256,262,274,278,298,302,314,326,334,338,346,358,362,382
%N A138929 Twice the prime powers A000961.
%C A138929 Except for the initial term a(1)=2, indices k such that A020513(k)=Phi[k](-1) is prime, where Phi is a cyclotomic polynomial.
%C A138929 This is illustrated by the PARI code, although it is probably more efficient to calculate a(n) as 2*A000961(n).
%C A138929 { a(n)/2 ; n>1 } are also the indices for which A020500(k)=Phi[k](1) is prime.
%C A138929 A188666(k) = A000961(k+1) for k: a(k) <= k < a(k+1), k > 0;
%C A138929 A188666(a(n)) = A000961(n+1). [_Reinhard Zumkeller_, Apr 25 2011]
%H A138929 Paolo Xausa, <a href="/A138929/b138929.txt">Table of n, a(n) for n = 1..10000</a>
%H A138929 <a href="/index/Cy#CyclotomicPolynomialsValuesAtX">Index entries for cyclotomic polynomials, values at X</a>
%F A138929 a(n) = 2*A000961(n).
%F A138929 Equals {2} union { k | Phi[k](-1)=A020513(k) is prime } = {2} union { 2k | Phi[k](1)=A020500(k) is prime }.
%p A138929 a := n -> `if`(1>=nops(numtheory[factorset](n)),2*n,NULL):
%p A138929 seq(a(i),i=1..192); # _Peter Luschny_, Aug 12 2009
%t A138929 Join[{2}, Select[ Range[3, 1000], PrimeQ[ Cyclotomic[#, -1]] &]] (* _Robert G. Wilson v_, Mar 25 2012 - modified by _Paolo Xausa_, Aug 30 2024 to include a(1) *)
%t A138929 2*Join[{1}, Select[Range[500], PrimePowerQ]] (* _Paolo Xausa_, Aug 30 2024 *)
%o A138929 (PARI) print1(2);for( i=1,999, isprime( polcyclo(i,-1)) & print1(",",i)) /* use ...subst(polcyclo(i),x,-2)... in PARI < 2.4.2. It should be more efficient to calculate a(n) as 2*A000961(n) ! */
%o A138929 (Python)
%o A138929 from sympy import primepi, integer_nthroot
%o A138929 def A138929(n):
%o A138929     def f(x): return int(n-1+x-sum(primepi(integer_nthroot(x,k)[0]) for k in range(1,x.bit_length())))
%o A138929     kmin, kmax = 0,1
%o A138929     while f(kmax) > kmax:
%o A138929         kmax <<= 1
%o A138929     while kmax-kmin > 1:
%o A138929         kmid = kmax+kmin>>1
%o A138929         if f(kmid) <= kmid:
%o A138929             kmax = kmid
%o A138929         else:
%o A138929             kmin = kmid
%o A138929     return kmax<<1 # _Chai Wah Wu_, Aug 29 2024
%Y A138929 Cf. A000961, A020513, A138920-A138940, A230078 (complement).
%K A138929 nonn
%O A138929 1,1
%A A138929 _M. F. Hasler_, Apr 04 2008