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.

Showing 1-4 of 4 results.

A176506 Difference between the prime indices of the two factors of the n-th semiprime.

Original entry on oeis.org

0, 1, 0, 2, 3, 1, 2, 4, 0, 5, 3, 6, 1, 7, 4, 8, 0, 5, 2, 6, 9, 10, 3, 7, 11, 1, 12, 4, 13, 8, 2, 9, 14, 5, 15, 10, 6, 16, 3, 0, 17, 11, 12, 4, 18, 13, 19, 1, 7, 20, 8, 21, 14, 5, 22, 0, 15, 23, 16, 9, 2, 24, 17, 25, 6, 10, 26, 3, 18, 27, 11, 7, 28, 19, 1, 29, 12, 20, 2, 21, 4, 30, 8, 31, 13, 22
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Apr 19 2010

Keywords

Comments

Are there no adjacent equal terms? I have verified this up to n = 10^6. - Gus Wiseman, Dec 04 2020

Examples

			From _Gus Wiseman_, Dec 04 2020: (Start)
The sequence of semiprimes together with the corresponding differences begins:
   4: 1 - 1 = 0
   6: 2 - 1 = 1
   9: 2 - 2 = 0
  10: 3 - 1 = 2
  14: 4 - 1 = 3
  15: 3 - 2 = 1
  21: 4 - 2 = 2
  22: 5 - 1 = 4
  25: 3 - 3 = 0
  26: 6 - 1 = 5
  33: 5 - 2 = 3
(End)
		

Crossrefs

Cf. A109313.
A087794 is product of the same indices.
A176504 is the sum of the same indices.
A115392 lists positions of first appearances.
A128301 lists positions of 0's.
A172348 lists positions of 1's.
A338898 has this sequence as row differences.
A338900 is the squarefree case.
A338912/A338913 give the two prime indices of semiprimes.
A006881 lists squarefree semiprimes.
A024697 is the sum of semiprimes of weight n.
A056239 gives sum of prime indices (Heinz weight).
A087112 groups semiprimes by greater factor.
A270650/A270652/A338899 give the prime indices of squarefree semiprimes.
A338904 groups semiprimes by weight.
A338907/A338906 list semiprimes of odd/even weight.
A339114/A339115 give the least/greatest semiprime of weight n.

Programs

  • Maple
    isA001358 := proc(n) numtheory[bigomega](n) = 2 ; end proc:
    A001358 := proc(n) option remember ; if n = 1 then return 4 ; else for a from procname(n-1)+1 do if isA001358(a) then return a; end if; end do; end if; end proc:
    A084126 := proc(n) min(op(numtheory[factorset](A001358(n)))) ; end proc:
    A084127 := proc(n) max(op(numtheory[factorset](A001358(n)))) ; end proc:
    A176506 := proc(n) numtheory[pi](A084127(n)) - numtheory[pi](A084126(n)) ; end proc: seq(A176506(n),n=1..120) ; # R. J. Mathar, Apr 22 2010
    # Alternative:
    N:= 500: # to use the first N semiprimes
    Primes:= select(isprime, [2,seq(i,i=3..N/2,2)]):
    SP:= NULL:
    for i from 1 to nops(Primes) do
      for j from 1 to i do
        sp:= Primes[i]*Primes[j];
        if sp > N then break fi;
        SP:= SP, [sp, i-j]
    od od:
    SP:= sort([SP],(s,t) -> s[1] t[2], SP); # Robert Israel, Jan 17 2019
  • Mathematica
    M = 500; (* to use the first M semiprimes *)
    primes = Select[Join[{2}, Range[3, M/2, 2]], PrimeQ];
    SP = {};
    For[i = 1, i <= Length[primes], i++,
      For[j = 1, j <= i, j++,
        sp = primes[[i]] primes[[j]];
        If[sp > M, Break []];
        AppendTo[SP, {sp, i - j}]
    ]];
    SortBy[SP, First][[All, 2]] (* Jean-François Alcover, Jul 18 2020, after Robert Israel *)
    Table[If[!SquareFreeQ[n],0,-Subtract@@PrimePi/@First/@FactorInteger[n]],{n,Select[Range[100],PrimeOmega[#]==2&]}] (* Gus Wiseman, Dec 04 2020 *)
  • PARI
    lista(nn) = {my(vsp = select(x->(bigomega(x)==2), [1..nn])); vector(#vsp, k, my(f=factor(vsp[k])[,1]); primepi(vecmax(f)) - primepi(vecmin(f)));} \\ Michel Marcus, Jul 18 2020

Formula

a(n) = A049084(A084127(n)) - A049084(A084126(n)). [corrected by R. J. Mathar, Apr 22 2010]
a(n) = A338913(n) - A338912(n). - Gus Wiseman, Dec 04 2020

Extensions

a(51) and a(69) corrected by R. J. Mathar, Apr 22 2010

A068318 Sum of prime factors of n-th semiprime.

Original entry on oeis.org

4, 5, 6, 7, 9, 8, 10, 13, 10, 15, 14, 19, 12, 21, 16, 25, 14, 20, 16, 22, 31, 33, 18, 26, 39, 18, 43, 22, 45, 32, 20, 34, 49, 24, 55, 40, 28, 61, 24, 22, 63, 44, 46, 26, 69, 50, 73, 24, 34, 75, 36, 81, 56, 30, 85, 26, 62, 91, 64, 42, 28, 99, 70, 103, 36, 46, 105, 30, 74, 109
Offset: 1

Views

Author

Reinhard Zumkeller, Feb 27 2002

Keywords

Comments

Odd k is a term if and only if k - 2 is prime. Goldbach's conjecture implies that every even number k >= 4 is a term. - Jianing Song, May 26 2021

Examples

			a(2) = 5 because A001358(2) = 6 = 2*3 and 2+3 = 5.
		

Crossrefs

Programs

  • Maple
    with(numtheory): a:=proc(n) if bigomega(n)=2 and nops(factorset(n))=2 then factorset(n)[1]+factorset(n)[2] elif bigomega(n)=2 then 2*sqrt(n) else fi end: seq(a(n),n=1..214); # Emeric Deutsch
  • Mathematica
    f[n_] := Total[#1*#2 & @@@ FactorInteger@ n]; f@# & /@ Select[Range@300, PrimeOmega@# == 2 &] (* Robert G. Wilson v, Jan 23 2013 *)
  • PARI
    s(n) = my(f = factor(n)); if(bigomega(f) == 2, f[,1]~*f[,2], 0);
    list(lim) = select(x -> x > 0, apply(s, vector(lim, i, i))); \\ Amiram Eldar, May 15 2025
  • Python
    from math import isqrt
    from sympy import primepi, primerange, factorint
    def A068318(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return int(n+x+((t:=primepi(s:=isqrt(x)))*(t-1)>>1)-sum(primepi(x//p) for p in primerange(s+1)))
        return sum(p*e for p,e in factorint(bisection(f,n,n)).items()) # Chai Wah Wu, Apr 03 2025
    

Formula

a(n) = A001414(A001358(n)).
a(n) = A003415(A001358(n)), the arithmetic derivative.
If A001358(n) = s*p, then in this sequence a(n) = s+p.
a(n) = A084126(n)+A084127(n). - Reinhard Zumkeller, Jul 24 2006 [Typo in formula fixed by Zak Seidov, Aug 23 2014]

A131284 Numbers n such that difference between prime factors of n-th semiprime is n.

Original entry on oeis.org

5, 80, 86, 613668, 6384425704
Offset: 1

Views

Author

Zak Seidov, Sep 25 2007

Keywords

Comments

The 6384425704th semiprime is 44690979977 = 7*6384425711. 6384425711 - 7 = 6384425704. - Donovan Johnson, Jul 11 2010

Examples

			sp(5) = 14 = 2*7 and 7 - 2 = 5, sp(80) = 249 = 3*83 and 83 - 3 = 80, sp(86) = 267 = 3*89 and 89 - 3 = 86; sp(n) = n-th semiprime.
		

Crossrefs

Programs

  • PARI
    { n=0; j=1; /* n=3068365-1; j=613668;*/
    while( l=(j\10^4+1)*10^4, until( l < j++, until(bigomega(n+=1)==2,);
    if(2!=#f=factor(n)[,1],next); if(j==f[2]-f[1],print("\n",[j,n,f])));
    print1(j-1,":"n", "))} \\ M. F. Hasler, Sep 28 2007

Extensions

a(4) = 613668 (p=5, q=613673) from M. F. Hasler, Sep 28 2007
a(5) from Donovan Johnson, Jul 11 2010

A178313 Absolute difference between prime factors of n-th semiprime mod n.

Original entry on oeis.org

0, 1, 0, 3, 0, 2, 4, 1, 0, 1, 8, 3, 2, 3, 10, 5, 0, 14, 6, 16, 6, 7, 8, 20, 10, 4, 12, 12, 12, 26, 6, 28, 12, 14, 16, 34, 18, 19, 10, 0, 18, 38, 40, 12, 20, 44, 22, 2, 24, 21, 26, 25, 50, 16, 26, 0, 56, 29, 58, 32, 6, 33, 1, 35, 22, 36, 34, 8, 68, 35, 38, 24, 34, 70, 4, 35, 42, 76, 6, 0
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Dec 20 2010

Keywords

Examples

			a(2)=1 because semiprime(2) = 6 = 3*2 and (3-2) mod 2 = 1.
		

Crossrefs

Programs

  • Mathematica
    semiPrimeQ[n_] := Plus @@ Last /@ FactorInteger@ n == 2; f[n_] := Subtract @@ Reverse@ Flatten[ Table[ #[[1]], {#[[2]]}] & /@ FactorInteger@ n]; t = Select[ Range@ 215, semiPrimeQ]; Table[ Mod[ f[ t[[n]]], n], {n, 80}]
    f[{a_,b_}]:=Module[{c=FactorInteger[b][[;;,1]]},If[Length[c]==1,0,Mod[Differences[c][[1]],a]]]; Module[{nn=300,spr},spr=Select[Range[nn],PrimeOmega[#]==2&];f/@Thread[{Range[ Length[ spr]],spr}]] (* Harvey P. Dale, May 29 2024 *)
  • Python
    from math import isqrt
    from sympy import primepi, primerange, primefactors
    from sympy.ntheory.primetest import is_square
    def A178313(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return int(n+x+((t:=primepi(s:=isqrt(x)))*(t-1)>>1)-sum(primepi(x//p) for p in primerange(s+1)))
        return 0 if is_square(m:=bisection(f,n,n)) else ((p:=primefactors(m))[1]-p[0])%n # Chai Wah Wu, Apr 03 2025
Showing 1-4 of 4 results.