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.

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