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.

A053707 First differences of A025475, powers of a prime but not prime.

This page as a plain text file.
%I A053707 #20 Aug 14 2024 01:51:10
%S A053707 3,4,1,7,9,2,5,17,15,17,40,4,3,41,74,13,33,54,18,151,17,96,104,112,
%T A053707 120,63,307,38,312,168,199,139,10,12,192,408,316,356,240,375,393,424,
%U A053707 128,288,912,320,298,30,1032,271,1217,792,408,840,432,286,602,1872,984,504
%N A053707 First differences of A025475, powers of a prime but not prime.
%C A053707 In the graph of this sequence, the lowest curve corresponds to differences of squares of twin primes; the next-lowest curve is for squares of adjacent primes differing by 4, etc. - _T. D. Noe_, Aug 03 2007
%H A053707 T. D. Noe, <a href="/A053707/b053707.txt">Table of n, a(n) for n=1..10000</a>
%F A053707 a(n) = A025475(n+1) - A025475(n).
%e A053707 2^0 = 1 is the first number that meets the definition of A025475, the next one is 2^2 = 4, hence a(1) = 4 - 1 = 3.
%e A053707 a(3) = A025475(4) - A025475(3) = 9 - 8 = 1; a(11) = A025475(12) - A025475(11) = 121 - 81 = 40.
%t A053707 Differences@ Join[{1}, Select[Range@ 16200, And[! PrimeQ@ #, PrimePowerQ@ #] &]] (* _Michael De Vlieger_, Jul 04 2016 *)
%o A053707 (PARI) {k=1; for(n=2,16300,if(matsize(factor(n))[1]==1&&factor(n)[1,2]>1,d=n-k; print1(d,","); k=n))} \\ _Klaus Brockhaus_, Sep 25 2003
%o A053707 (Python)
%o A053707 from sympy import primepi, integer_nthroot
%o A053707 def A053707(n):
%o A053707     if n==1: return 3
%o A053707     def f(x): return int(n-2+x-sum(primepi(integer_nthroot(x,k)[0]) for k in range(2,x.bit_length())))
%o A053707     kmin, kmax = 1,2
%o A053707     while f(kmax)+1 >= kmax:
%o A053707         kmax <<= 1
%o A053707     rmin, rmax = 1, kmax
%o A053707     while True:
%o A053707         kmid = kmax+kmin>>1
%o A053707         if f(kmid)+1 < kmid:
%o A053707             kmax = kmid
%o A053707         else:
%o A053707             kmin = kmid
%o A053707         if kmax-kmin <= 1:
%o A053707             break
%o A053707     while True:
%o A053707         rmid = rmax+rmin>>1
%o A053707         if f(rmid) < rmid:
%o A053707             rmax = rmid
%o A053707         else:
%o A053707             rmin = rmid
%o A053707         if rmax-rmin <= 1:
%o A053707             break
%o A053707     return kmax-rmax # _Chai Wah Wu_, Aug 13 2024
%Y A053707 Cf. A025475.
%K A053707 nonn
%O A053707 1,1
%A A053707 _Labos Elemer_, Feb 14 2000
%E A053707 Edited by _Klaus Brockhaus_, Sep 25 2003