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-2 of 2 results.

A336016 a(n) is the number of primes q less than primorial(n) having k = 2 as the least exponent such that q^k == 1 (mod primorial(n)).

Original entry on oeis.org

0, 1, 3, 5, 8, 19, 22, 51, 89, 145, 263, 453, 851, 1575, 2880, 5469, 10338, 19115, 35782, 67569, 128601, 243600, 463840, 883589
Offset: 1

Views

Author

Keywords

Comments

a(n) = length of row n of A336015 for n > 1.

Examples

			a(4) = 5 as there are 5 primes q coprime to primorial(4) = 210 such that 2 is the least positive integer exponent k where q^k == 1 (mod 210). Those primes are 29, 41, 71, 139, 181 and indeed we have 29^2 == 1 (mod 210), 41^2 == 1 (mod 210), 71^2 == 1 (mod 210), 139^2 == 1 (mod 210) and 181^2 == 1 (mod 210) and no more below 210. So as these are five such primes in row 4, a(4) = 5. - _David A. Corneth_, Aug 15 2020
		

Crossrefs

Programs

  • Mathematica
    Table[Block[{P = #, k = 0}, Do[If[MultiplicativeOrder[Prime@ i, P] == 2, k++], {i, PrimePi[n + 1], PrimePi[P - 1]}]; k] &@ Product[Prime@ j, {j, n}], {n, 8}]
  • PARI
    a(n) = {if(n <= 2, return(n-1)); my(pp = vecprod(primes(n))/2, d = divisors(pp), res = 0); for(i = 1, #d, c = lift(chinese(Mod(-1, d[i]), Mod(1, pp/d[i]))); forstep(i = c, pp*2, pp, if(isprime(i), res++ ) ) ); res } \\ David A. Corneth, Aug 16 2020

Extensions

New name from David A. Corneth, Aug 15 2020

A336093 Let P(n) = primorial(n) = A002110(n); a(n) is the number of primes q < P(n) such that P(n) - q is also prime and q^2==1 (mod P(n)).

Original entry on oeis.org

0, 0, 2, 4, 2, 8, 6, 28, 36, 40, 56, 106, 192, 304, 526, 926, 1644, 2756, 4944, 8840, 15958, 28402, 51102, 92372
Offset: 1

Views

Author

Keywords

Comments

A totative of k is a number <= k and relatively prime to k.
A336016(n) gives the number of prime totatives p of P(n) for which p^2==1 (mod P(n)). Whereas P(n) - p also has this property, it is not always prime. This sequence gives the number of prime totatives q of P(n) such that q^2==1 mod P(n) and P(n) - q is also prime. All terms are even; a(n) <= A336016(n) for all n. The number of distinct representations of P(n) as the sum of two primes each having multiplicative order 2 (mod P(n)) is given by a(n)/2, for which A116979(n) is an upper bound.

Examples

			P(4)=210; all totatives 29,41,71,139,181 are prime. However 210 - 41 = 169 is not prime, whereas 210-29 = 181, 210-71 = 139. Therefore the totatives we count in this case are 29,71,139,181, so a(4) = 4.
		

Crossrefs

Programs

  • Maple
    with(NumberTheory):
    P := proc (k)
    local n, v, W, H;
    n := 1; v := 0;
    W := product(ithprime(j), j = 1 .. k);
    H := PrimeCounting(W);
    for n from 1 to H do
    if mod(ithprime(n)^2, W) = 1 and isprime(W-ithprime(n)) then v := v+1 else v := v end if:
    end do:
    v;
    end proc:
    seq(P(k), k = 1 .. 8);
  • Mathematica
    {0, 0}~Join~Table[Block[{P = #, k = 0}, Do[If[AllTrue[{#, P - #}, And[PrimeQ@ #, MultiplicativeOrder[#, P] == 2] &], k++] &@ Prime[i], {i, PrimePi[n + 1], PrimePi[P/2]}]; 2 k ] &@ Product[Prime@ j, {j, n}], {n, 3, 8}]
Showing 1-2 of 2 results.