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.

User: Dimitri Papadopoulos

Dimitri Papadopoulos's wiki page.

Dimitri Papadopoulos has authored 11 sequences. Here are the ten most recent ones:

A299016 Integer radii of circles over an integer lattice such that the number of unit squares whose centers are contained in the circle is less than the area of the circle.

Original entry on oeis.org

2, 6, 12, 19, 24, 36, 40, 43, 48, 52, 53, 55, 60, 61, 65, 70, 74, 77, 89, 91, 108, 111, 116, 123, 125, 128, 129, 140, 141, 142, 146, 152, 154, 159, 166, 169, 171, 180, 181, 183, 184, 197, 198, 205, 209, 210, 212, 214, 222
Offset: 1

Author

Dimitri Papadopoulos, Jun 19 2018

Keywords

Examples

			For the circle with radius a(1) = 2, the point  (3/2, 3/2 ), i.e. the center of the unit square bounded by x = 1, x = 2, y = 1, y = 2, is outside the circle of radius 2 centered at the origin so there are 12 unit squares with centers inside the circle of radius 2, and 12 <  Pi *2 *2.
		

Programs

  • Mathematica
    t = {}; For[n = 1, n < 223, n++, cnt = 0; For[x = -n, x < 0, x++, For[y = -n, y < 0, y++, If[N[Norm[{x + 1/2, y + 1/2}]] < n, cnt++]]] If[Pi*n*n > 4*cnt, t = Append[t, n]]] Print[t];

A267632 Triangle T(n, k) read by rows: the k-th column of the n-th row lists the number of ways to select k distinct numbers (k >= 1) from [1..n] so that their sum is divisible by n.

Original entry on oeis.org

1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 2, 2, 1, 1, 1, 2, 4, 3, 1, 0, 1, 3, 5, 5, 3, 1, 1, 1, 3, 7, 9, 7, 3, 1, 0, 1, 4, 10, 14, 14, 10, 4, 1, 1, 1, 4, 12, 22, 26, 20, 12, 5, 1, 0, 1, 5, 15, 30, 42, 42, 30, 15, 5, 1, 1, 1, 5, 19, 42, 66, 76, 66, 43, 19, 5, 1, 0
Offset: 1

Author

Dimitri Papadopoulos, Jan 18 2016

Keywords

Comments

Row less the last element is palindrome for n=odd or n=power of 2 where n is the row number (observation-conjecture).
From Petros Hadjicostas, Jul 13 2019: (Start)
By reading carefully the proof of Lemma 5.1 (pp. 65-66) in Barnes (1959), we see that he actually proved a general result (even though he does not state it in the lemma).
According to the definition of this sequence, for 1 <= k <= n, T(n, k) is the number of unordered sets b_1, b_2, ..., b_k of k distinct integers from 1..n such that b_1 + b_2 + ... + b_k = 0 (mod n). The proof of Lemma 5.1 in Barnes (1959) implies that T(n, k) = (1/n) * Sum_{s | gcd(n, k)} (-1)^(k - (k/s)) * phi(s) * binomial(n/s, k/s) for 1 <= k <= n.
For fixed k >= 1, the g.f. of the column (T(n, k): n >= 1) (with T(n, k) = 0 for 1 <= n < k) is (x^k/k) * Sum_{s|k} phi(s) * (-1)^(k - (k/s)) / (1 - x^s)^(k/s), which generalizes Herbert Kociemba's formula from A032801.
Barnes' (1959) formula is a special case of Theorem 4 (p. 66) in Ramanathan (1944). If R(n, k, v) is the number of unordered sets b_1, b_2, ..., b_k of k distinct integers from 1..n such that b_1 + b_2 + ... + b_k = v (mod n), then he proved that R(n, k, v) = (1/n) * Sum_{s | gcd(n,k)} (-1)^(k - (k/s)) * binomial(n/s, k/s) * C_s(v), where C_s(v) = A054535(s, v) = Sum_{d | gcd(s,v)} d * Moebius(s/d) is Ramanujan's sum (even though it was first discovered around 1900 by the Austrian mathematician R. D. von Sterneck).
Because C_s(v = 0) = phi(s), we get Barnes' (implicit) result; i.e., R(n, k, v=0) = T(n, k) for 1 <= k <= n.
For k=2, we have R(n, k=2, v=0) = T(n, k=2) = A004526(n-1) for n >= 1. For k=3, we have R(n, k=3, v=0) = T(n, k=3) = A058212(n) for n >= 1. For k=4, we have R(n, k=4, v=0) = A032801(n) for n >= 1. For k=5, we have R(n, k=5, v=0) = T(n, k=5) = A008646(n-5) for n >= 5.
The reason we have T(2*m+1, k) = A037306(2*m+1, k) = A047996(2*m+1, k) for m >= 0 and k >= 1 is the following. When n = 2*m + 1, all divisors s of gcd(n, k) are odd. In such a case, k - (k/s) is even for all k >= 1, and thus (-1)^(k - (k/s)) = 1, and thus T(n = 2*m+1, k) = (1/n) * Sum_{s | gcd(n, k)} phi(s) * binomial(n/s, k/s) = A037306(2*m+1, k) = A047996(2*m+1, k).
By summing the products of the g.f. of column k times y^k from k = 1 to k = infinity, we get the bivariate g.f. for the array: Sum_{n, k >= 1} T(n, k)*x^n*y^k = Sum_{s >= 1} (phi(s)/s) * log((1 - x^s + (-x*y)^s)/(1 - x^s)) = -x/(1 - x) - Sum_{s >= 1} (phi(s)/s) * log(1 - x^s + (-x*y)^s).
Letting y = 1 in the above bivariate g.f., we get the g.f. of the sequence (Sum_{1 <= k <= n} T(n, k): n >= 1) is -x/(1 - x) - Sum_{s >= 1} (phi(s)/s) * log(1 - x^s + (-x)^s) = -x/(1 - x) + Sum_{m >= 0} (phi(2*m + 1)/(2*m + 1)) * log(1 - 2*x^(2*m+1)), which is the g.f. of sequence A082550. Hence, sequence A082550 consists of the row sums.
There is another important interpretation of this array T(n, k) which is related to some of the references for sequence A047996, but because the discussion is too lengthy, we omit the details.
(End)

Examples

			For n = 5, there is one way to pick one number (5), two ways to pick two numbers (1+4, 2+3), two ways to pick 3 numbers (1+4+5, 2+3+5), one way to pick 4 numbers (1+2+3+4), and one way to pick 5 numbers (1+2+3+4+5) so that their sum is divisible by 5. Therefore, T(5,1) = 1, T(5,2) = 2, T(5,3) = 2, T(5,4) = 1, and T(5,5) = 1.
Table for T(n,k) begins as follows:
n\k 1 2   3    4    5    6    7    8    9   10
1   1
2   1 0
3   1 1   1
4   1 1   1    0
5   1 2   2    1    1
6   1 2   4    3    1    0
7   1 3   5    5    3    1    1
8   1 3   7    9    7    3    1    0
9   1 4  10   14   14   10    4    1    1
10  1 4  12   22   26   20   12    5    1    0
...
		

Programs

  • Maple
    A267632 := proc(n,k)
        local a,msel,p;
        a := 0 ;
        for msel in combinat[choose](n,k) do
            if modp(add(p,p=msel),n) = 0 then
                a := a+1 ;
            end if;
        end do:
        a;
    end proc: # R. J. Mathar, May 15 2016
    # second Maple program:
    b:= proc(n, m, s) option remember; expand(`if`(n=0,
          `if`(s=0, 1, 0), b(n-1, m, s)+x*b(n-1, m, irem(s+n, m))))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=1..n))(b(n$2, 0)):
    seq(T(n), n=1..14);  # Alois P. Heinz, Aug 27 2018
  • Mathematica
    f[k_, n_] :=  Length[Select[Select[Subsets[Range[n]], Length[#] == k &], IntegerQ[Total[#]/n] &]];MatrixForm[Table[{n, Table[f[k, n], {k, n}]}, {n, 10}]] (* Dimitri Papadopoulos, Jan 18 2016 *)

Formula

T(2n+1, k) = A037306(2n+1, k) = A047996(2n+1, k).
From Petros Hadjicostas, Jul 13 2019: (Start)
T(n, k) = (1/n) * Sum_{s | gcd(n, k)} (-1)^(k - (k/s)) * phi(s) * binomial(n/s, k/s) for 1 <= k <= n.
G.f. for column k >= 1: (x^k/k) * Sum_{s|k} phi(s) * (-1)^(k - (k/s)) / (1 - x^s)^(k/s).
Bivariate g.f.: Sum_{n, k >= 1} T(n, k)*x^n*y^k = -x/(1 - x) - Sum_{s >= 1} (phi(s)/s) * log(1 - x^s + (-x*y)^s).
(End)
Sum_{k=1..n} k * T(n,k) = A309122(n). - Alois P. Heinz, Jul 13 2019

A268397 a(n) is the smallest prime with at least n consecutive primitive roots.

Original entry on oeis.org

2, 5, 11, 37, 53, 83, 83, 269, 269, 467, 467, 1187, 1559, 1559, 1559, 6803, 6803, 6803, 10559, 10559, 10559, 35279, 38639, 38639, 38639, 38639, 38639
Offset: 1

Author

Dimitri Papadopoulos, Feb 03 2016

Keywords

Examples

			a(4)=37. 37 has the primitive roots 2, 5, 13, 15, 17, 18, 19, 20, 22, 24, 32, and 35 of which 17, 18, 19, and 20 are consecutive.
		

Crossrefs

Cf. A060749, A261438 (has "exactly" instead of "at least").

Programs

  • Mathematica
    PrimRoot[n_] :=Flatten[Position[Table[MultiplicativeOrder[i, n], {i, n - 1}],n - 1]];t = {};For[targ = 1, targ <= 22, targ++,flag = 0; For[n = 1, n < 1500, n++,prs = PrimRoot[Prime[n]];numprs = EulerPhi[Prime[n] - 1]; If[targ > numprs, ,For[m = 1, m <= numprs + 1 - targ, m++,temp = Take[prs, {m, m + targ - 1}];If[temp[[1]] + targ - 1 == temp[[targ]] && flag == 0,t = Append[t, Prime[n]]; flag = 1];If[flag == 1, Break[]];]; If[flag == 1, Break[]];];If[flag == 1, Break[]];]]; t
    Join[{2},Module[{prl=Table[{p,Max[Length/@Select[Split[ Differences[ PrimitiveRootList[ p]]], #[[1]]==1&]]},{p,Prime[Range[1500]]}]},Table[ SelectFirst[ prl, #[[2]]>=k&],{k,20}]][[All, 1]]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 23 2019 *)

Extensions

More terms from Harvey P. Dale, Aug 23 2019

A267133 a(n) = (1/n)(2/n)(3/n)...((n-1)/n) where (k/n) is the Kronecker symbol, n >= 1.

Original entry on oeis.org

1, 1, -1, 0, 1, 0, -1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 1, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 1, 0, 0
Offset: 1

Author

Dimitri Papadopoulos, Jan 10 2016

Keywords

Examples

			a(3) = (1/3)(2/3) = (1)(-1) = -1.
		

Programs

  • Maple
    f:= proc(n) if not isprime(n) then 0 elif n mod 4 = 3 then -1 else 1 fi end proc:
    f(1):= 1:
    map(f, [$1..1000]); # Robert Israel, Jan 14 2016
  • Mathematica
    Table[Product[JacobiSymbol[k, n], {k, n - 1}], {n, 75}] (* Michael De Vlieger, Jan 12 2016 *)
  • PARI
    a(n) = prod(k=1, n-1, kronecker(k, n)); \\ Michel Marcus, Jan 11 2016
    
  • PARI
    a(n)=if(isprime(n),(-1)^(n%4>2),n==1) \\ Charles R Greathouse IV, Jan 14 2016

Formula

A080339(n) = abs(a(n)) = a(n)^2.
a(c) = 0 if c is composite (A002808).
a(p) = 1 for primes p in A002313.
a(p) = -1 for primes p in A002145.
a(n) = A057077(n+3)*A080339(n) for n > 1. - Robert Israel, Jan 14 2016
a(n) = A151763(n), n > 2. - R. J. Mathar, Jan 17 2016

Extensions

"Jacobi symbol" in Name changed to "Kronecker symbol" by Jianing Song, Dec 30 2018

A267010 Primes of the form p==3 (mod 4) such that the average of their primitive roots equals p/2.

Original entry on oeis.org

19, 307, 1451, 2179, 2251, 2683, 2843, 3259, 3907, 4447, 11863, 12907, 17623, 30763, 37963, 51059, 52543, 86131, 92467, 104851, 129763, 131203, 146683, 150151, 156151, 156703, 162523, 163819, 174007, 245899, 263827, 287731, 348643, 353611, 400123, 412831, 423091, 432587
Offset: 1

Author

Dimitri Papadopoulos, Jan 08 2016

Keywords

Comments

Most primes for which the average of the primitive roots=p/2 are of the form p==1(mod 4). Much rarer for primes of form p==3(mod 4) to have this property. (Observation)

Examples

			19 is a term because the primitive roots of 19 are 2, 3, 10, 13, 14, and 15. Their average is (2+3+10+13+14+15)/phi(18)=57/phi(18)=57/6=19/2.
		

Crossrefs

Cf. A060749. Intersection of A002145 and A266987.

Programs

  • Maple
    isA267010 := proc(n)
        if isprime(n) and modp(n,4) = 3 then
            isA266987(n) ;
        else
            false;
        end if;
    end proc: # R. J. Mathar, Aug 14 2024
  • Mathematica
    f[n_] := If[Total[Flatten[Position[Table[MultiplicativeOrder[i, Prime[n]], {i, Prime[n] - 1}],    Prime[n] - 1]]] == EulerPhi[Prime[n] - 1]*Prime[n]/2, 1, 0];
    For[k = 1, k < 10000, k++, If[f[k] == 1 && Mod[Prime[k], 4] == 3, Print[k, "  ", Prime[k]]]]
    Select[4*Range[1000] + 3, PrimeQ[#] && Mean[PrimitiveRootList[#]] == #/2 &] (* Amiram Eldar, Oct 11 2021 *)
  • PARI
    vr(p) = j=0; r=vector(eulerphi(p-1)); pr=znprimroot(p); for(i=1, p-1, if(gcd(i, p-1)==1, r[j++]=lift(pr^i))); r; \\ after A060749
    isok(p) = ((p % 4 == 3) && (vpr = vr(p)) && (vecsum(vpr) == #vpr*p/2)); \\ Michel Marcus, Jan 09 2016

Extensions

a(16)-a(38) from Michel Marcus, Jan 09 2016

A267009 Primes p for which the average of the primitive roots is > p/2.

Original entry on oeis.org

3, 7, 11, 23, 47, 59, 71, 79, 83, 103, 107, 127, 131, 139, 151, 163, 167, 179, 191, 199, 211, 227, 239, 251, 263, 271, 283, 311, 331, 347, 359, 367, 383, 419, 431, 439, 443, 463, 467, 479, 487, 499, 503, 523, 547, 563, 571, 587, 599, 607, 647, 659, 691, 719, 727
Offset: 1

Author

Dimitri Papadopoulos, Jan 08 2016

Keywords

Comments

It appears that these primes are all congruent to 3 (mod 4).

Examples

			a(2) = 7 since the primitive roots of 7 are 3 and 5 and their average is (3+5)/2 = 8/2 > 7/2.
		

Crossrefs

Programs

  • Mathematica
    A = Table[Total[Flatten[Position[Table[MultiplicativeOrder[i, Prime[k]], {i, Prime[k] - 1}], Prime[k] - 1]]]/(EulerPhi[Prime[k] - 1] Prime[k]/2), {k, 1, 1000}]; Prime[Flatten[Position[A, _?(# > 1 &)]]]
    Select[Range[1000], PrimeQ[#] && Mean[PrimitiveRootList[#]] > #/2 &] (* Amiram Eldar, Oct 09 2021 *)

Formula

a(n) = prime(A266990(n)).

A266990 The indices of primes p for which the average of the primitive roots is > p/2.

Original entry on oeis.org

2, 4, 5, 9, 15, 17, 20, 22, 23, 27, 28, 31, 32, 34, 36, 38, 39, 41, 43, 46, 47, 49, 52, 54, 56, 58, 61, 64, 67, 69, 72, 73, 76, 81, 83, 85, 86, 90, 91, 92, 93, 95, 96, 99, 101, 103, 105, 107, 109, 111, 118, 120, 125, 128, 129, 131, 132, 133, 138, 141, 143, 144, 146, 150
Offset: 1

Author

Dimitri Papadopoulos, Jan 08 2016

Keywords

Comments

It appears that these primes are all congruent to 3 (mod 4).

Examples

			a(2) = 4 is a term since prime(a(2)) = prime(4) = 7, the primitive roots of 7 are 3 and 5 and their average is (3+5)/2 = 8/2 > 7/2.
		

Crossrefs

Programs

  • Mathematica
    A = Table[Total[Flatten[Position[Table[MultiplicativeOrder[i, Prime[k]], {i, Prime[k] - 1}],Prime[k] - 1]]]/(EulerPhi[Prime[k] - 1] Prime[k]/2), {k, 1, 1000}]; Flatten[Position[A, _?(# > 1 &)]]
    Select[Range[150], Mean[PrimitiveRootList[(p = Prime[#])]] > p/2 &] (* Amiram Eldar, Oct 09 2021 *)

Formula

a(n) = A000720(A267009(n)). - Amiram Eldar, Oct 09 2021

A266989 Primes for which the average of the primitive roots is < p/2.

Original entry on oeis.org

31, 43, 67, 223, 379, 491, 619, 631, 643, 683, 859, 883, 907, 1051, 1091, 1423, 1747, 1987, 2143, 2347, 2371, 2467, 2531, 2767, 3307, 3643, 3691, 3739, 3823, 3931, 4019, 4219, 4519, 4691, 4987, 5059, 5107, 5347, 5683, 5827, 6043
Offset: 1

Author

Dimitri Papadopoulos, Jan 08 2016

Keywords

Comments

These primes are congruent to 3 (mod 4).

Examples

			a(1)=31. The primitive roots of 31 are 3, 11, 12, 13, 17, 21, 22, and 24.
Their average is (3+11+12+13+17+21+22+24)/phi(30)=123/8<31/2.
		

Programs

  • Maple
    f:= proc(p) local g;
      if not isprime(p) then return false fi;
      g:= numtheory[primroot](p);
      evalb(add(g&^i mod p, i = select(t->igcd(t,p-1)=1, [$1..p-2]))
         < p/2 * numtheory:-phi(p-1))
    end proc:
    select(f, [seq(i,i=3..10000,4)]); # Robert Israel, Feb 09 2016
  • Mathematica
    A = Table[Total[Flatten[Position[Table[MultiplicativeOrder[i, Prime[k]], {i, Prime[k] - 1}],Prime[k] - 1]]]/(EulerPhi[Prime[k] - 1] Prime[k]/2), {k, 1,100}]; Prime[Flatten[Position[A, _?(# < 1 &)]]]
  • PARI
    ar(p) = my(r, pr, j); r=vector(eulerphi(p-1)); pr=znprimroot(p); for(i=1, p-1, if(gcd(i, p-1)==1, r[j++]=lift(pr^i))); vecsort(r) ;
    isok(p) = my(vr = ar(p)); vecsum(vr)/#vr < p/2;
    lista(nn) = forprime(p=2, nn, if (isok(p), print1(p, ", "))); \\ Michel Marcus, Feb 09 2016

Formula

a(n) = prime(A266988(n)).

A266988 The indices of primes for which the average of the primitive roots is < p/2.

Original entry on oeis.org

11, 14, 19, 48, 75, 94, 114, 115, 117, 124, 149, 153, 155, 177, 182, 224, 272, 300, 324, 348, 351, 365, 370, 403, 465, 510, 515, 522, 531, 546, 555, 578, 614, 634, 667, 677, 683, 707, 748, 765, 788, 795, 802, 808, 832, 850, 871, 876, 886, 888, 966, 980
Offset: 1

Author

Dimitri Papadopoulos, Jan 08 2016

Keywords

Comments

These primes are all of the form p==3 (mod 4). (conjecture)

Examples

			p(a[1])=p(11)=31. The primitive roots of 31 are 3, 11, 12, 13, 17, 21, 22, and 24.
Their average is (3+11+12+13+17+21+22+24)/phi(30)=123/8<31/2.
		

Crossrefs

Programs

  • Mathematica
    A = Table[Total[Flatten[Position[Table[MultiplicativeOrder[i, Prime[k]], {i, Prime[k] - 1}],Prime[k] - 1]]]/(EulerPhi[Prime[k] - 1] Prime[k]/2), {k, 1, 1000}];Flatten[Position[A, _?(# < 1 &)]]

A266987 Primes p for which the average of the primitive roots equals p/2.

Original entry on oeis.org

2, 5, 13, 17, 19, 29, 37, 41, 53, 61, 73, 89, 97, 101, 109, 113, 137, 149, 157, 173, 181, 193, 197, 229, 233, 241, 257, 269, 277, 281, 293, 307, 313, 317, 337, 349, 353, 373, 389, 397, 401, 409, 421, 433, 449
Offset: 1

Author

Dimitri Papadopoulos, Jan 08 2016

Keywords

Comments

From Robert Israel, Feb 01 2016: (Start)
Union of A002144 and A267010.
Contains A002144 because for each of these primes, x is a primitive root iff p-x is a primitive root. (End)

Examples

			a(13) = 13 since the primitive roots of 13 are 2, 6, 7, and 11 and the average of these primitive roots is (2+6+7+11)/phi(12) = 26/4 = 13/2.
		

Programs

  • Maple
    proots := proc(n)
        local r,eulphi,m;
        if n = 1 then
            return {0} ;
        end if;
        eulphi := numtheory[phi](n) ;
        r := {} ;
        for m from 0 to n-1 do
            if numtheory[order](m,n) = eulphi then
                r := r union {m} ;
            end if;
        end do:
        return r;
    end proc:
    isA266987 := proc(n)
        local r;
        if isprime(n) then
            r := convert(proots(n),list) ;
            2*add(pr, pr=r)  = n*nops(r) ;
        else
            false;
        end if;
    end proc:
    for n from 1 to 500 do
        if isA266987(n) then
            printf("%d,",n);
        end if;
    end do: # R. J. Mathar, Jan 12 2016
    Filter:= proc(p) local x, s,js;
      if p mod 4 = 1 then return true fi;
      x:= numtheory:-primroot(p);
      js:= select(t -> igcd(t,p-1)=1, [$1..p-2]);
      s:= add(x&^ j mod p, j=js);
      evalb(s = p/2 * nops(js))
    end proc:
    select(Filter, [seq(ithprime(i),i=1..1000)]); # Robert Israel, Feb 01 2016
  • Mathematica
    A = Table[Total[Flatten[Position[Table[MultiplicativeOrder[i, Prime[k]], {i, Prime[k] - 1}],Prime[k] - 1]]]/(EulerPhi[Prime[k] - 1] Prime[k]/2), {k, 1, 100}]; Prime[Flatten[Position[A, _?(# == 1 &)]]]
    (* second program (version >= 10): *)
    Select[Prime[Range[100]], Mean[PrimitiveRootList[#]] == #/2&] (* Jean-François Alcover, Jan 12 2016 *)

Formula

a(n) = prime(A266986(n)).