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

A338869 Shortest most frequent distance among first n primes.

Original entry on oeis.org

1, 1, 2, 2, 2, 2, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 30, 30, 30, 30, 6, 30, 6, 6, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30
Offset: 2

Views

Author

Andres Cicuttin, Nov 13 2020

Keywords

Comments

Conjecture: Shortest most frequent distance among first n primes is a primorial number (A002110) for n>1.
This sequence is quite related to A338238 with which it shares many terms.
The corresponding frequencies of the most frequent distances among n first primes are in A283371.

Examples

			For n = 2, the distance between the first two primes 2 and 3 is 1, so the only possible distance is also the most frequent one, then a(2) = 1.
For n = 3, the distances between the first three primes 2, 3 and 5 are 1 = 3 - 2, 3 = 5 - 2, and 2 = 5 - 3, so all three distances are different, have the same frequency, and the shortest among them is 1, then a(3) = 1.
For n = 4, the five different distances between the first four primes 2, 3, 5 and 7 are 1 = 3 - 2, 2 = 5 - 3 = 7 - 5, 3 = 7 - 4 , 4 = 7 - 3 and 5 = 7 - 2, then a(3) = 2 because 2 is the most common distance (two cases) compared with the other distances which appear only once.
For n = 32, the most frequent distances are 30 and 6, and both appear with the same frequency (19 cases), then a(32) = 6 because 6 is the shortest between 30 and 6.
		

Crossrefs

Programs

  • Mathematica
    a[n_]:=Module[{pset, p2s,diffp2s,sd,sdgb,sdgbst},
    pset=Prime[Range[n]]; (* First n primes *)
    p2s=Subsets[pset,{2}]; (* All possible pairs of primes *)
    (* Compute all possible distances and the corresponding frequencies *)
    diffp2s=Map[Differences,p2s]//Flatten//Tally ;
    (* Sort pairs {distance, frequency} by decreasing frequency *)
    sd=Sort[diffp2s,#1[[2]]>#2[[2]]&];
    (* Gather pairs {dist, freq} with same maximum frequency *)
    sdgb=GatherBy[sd,sd[[1]][[2]]==#[[2]] &];
    (* Sort selected pairs {dist, freq} with maximum frequency according to increasing distance *)
    sdgbst=Sort[sdgb[[1]],#1[[1]]<#2[[1]]&];
    (* Finally select and return the minimum distance among those with same maximum frequency *)
    sdgbst[[1]][[1]] //Return];
    Table[a[n],{n,2,100}]

A338238 Minimum number of rotations for a second maximum cyclic autocorrelation of the first n terms of the characteristic function of primes.

Original entry on oeis.org

1, 1, 1, 2, 3, 2, 2, 2, 2, 2, 4, 2, 6, 2, 8, 2, 4, 2, 6, 6, 6, 6, 6, 4, 6, 6, 6, 6, 6, 2, 6, 6, 6, 6, 12, 6, 6, 6, 6, 6, 18, 6, 6, 6, 6, 6, 24, 6, 6, 6, 6, 6, 24, 6, 6, 6, 24, 6, 6, 6, 6, 6, 6, 6, 24, 6, 6, 6, 6, 6, 24, 6, 6, 6, 6, 6, 24, 6, 6, 6, 6, 6, 30, 6, 30, 6, 12, 6, 30, 6, 6, 6, 6, 6, 30, 6, 30
Offset: 2

Views

Author

Andres Cicuttin, Oct 17 2020

Keywords

Comments

It seems that most frequent terms among the first ones assume values 1, 2, 6, 30, 210, 2310, . . . Primorials? Several scatter plots of sequences of different lengths suggest this pattern (See Link).

Examples

			The primes among the first 5 positive integers (1,2,3,4,5) are 2, 3, and 5, then the corresponding characteristic function of primes is (0,1,1,0,1) (See A010051) and the corresponding five possible cyclic autocorrelations are the dot products between (0,1,1,0,1) and its rotations as shown here below:
(0,1,1,0,1).(0,1,1,0,1) = 0*0 + 1*1 + 1*1 + 0*0 + 1*1 = 3, (0 rotations)
(0,1,1,0,1).(1,0,1,1,0) = 0*1 + 1*0 + 1*1 + 0*1 + 1*0 = 1, (1 rotation)
(0,1,1,0,1).(0,1,0,1,1) = 0*0 + 1*1 + 1*0 + 0*1 + 1*1 = 2, (2 rotations)
(0,1,1,0,1).(1,0,1,0,1) = 0*1 + 1*0 + 1*1 + 0*0 + 1*1 = 2, (3 rotations)
(0,1,1,0,1).(1,1,0,1,0) = 0*1 + 1*1 + 1*0 + 0*1 + 1*0 = 1, (4 rotations)
The maximum value of the cyclic autocorrelation is always trivially obtained with zero rotations. In this example, the maximum value is 3 and the second maximum is 2, then a(5)=2 because it is needed a minimum of 2 rotations to obtain the second maximum.
		

Crossrefs

Programs

  • Mathematica
    nmax = 2^7;
    b = Table[If[PrimeQ[i], 1, 0], {i, 1, nmax}];
    tab = Table[Table[b[[1;;n]].RotateRight[b[[1;;n]], j], {j, 1, n-1}], {n, 2, nmax}];
    tabmaxs = Table[Max[tab[[n]]], {n, 1, nmax-1}];
    a = Table[First@Position[tab[[j]], tabmaxs[[j]]], {j, 1, nmax-1}] // Flatten

A299053 Minimum value of the cyclic autocorrelation of first n primes.

Original entry on oeis.org

4, 12, 31, 62, 133, 224, 377, 558, 865, 1304, 1805, 2462, 3337, 4280, 5389, 6726, 8449, 10264, 12663, 15294, 18061, 21200, 24961, 29166, 34173, 39508, 45017, 50870, 57141, 63788, 72299, 81234, 91365, 101732, 113327, 125166, 138355, 152348, 167179, 182862
Offset: 1

Views

Author

Andres Cicuttin, Feb 01 2018

Keywords

Comments

Maximum values of the cyclic autocorrelation of first n primes are in A024450.
If we use this definition with integers instead of primes it is obtained A088003.

Examples

			For n = 4 the four possible cyclic autocorrelations of first four primes are:
(2,3,5,7).(2,3,5,7) = 2*2 + 3*3 + 5*5 + 7*7 = 4 + 9 + 25 + 49 = 87,
(2,3,5,7).(7,2,3,5) = 2*7 + 3*2 + 5*3 + 7*5 = 14 + 6 + 15 + 35 = 70,
(2,3,5,7).(5,7,2,3) = 2*5 + 3*7 + 5*2 + 7*3 = 10 + 21 + 10 + 21 = 62,
(2,3,5,7).(3,5,7,2) = 2*3 + 3*5 + 5*7 + 7*2 = 6 + 15 + 35 + 14 = 70,
then a(4)=62 because 62 is the minimum among the four values.
		

Crossrefs

Programs

  • Maple
    a:= n-> min(seq(add(ithprime(i)*ithprime(irem(i+k, n)+1), i=1..n), k=1..n)):
    seq(a(n), n=1..40);  # Alois P. Heinz, Feb 06 2018
  • Mathematica
    p[n_]:=Prime[Range[n]];
    Table[Table[p[n].RotateRight[p[n],j],{j,0,n-1}]//Min,{n,1,36}]
  • PARI
    a(n) = vecmin(vector(n, k, sum(i=1, n, prime(i)*prime(1+(i+k)%n)))); \\ Michel Marcus, Feb 07 2018

Formula

a(n) = Min_{k=1..n} Sum_{i=1..n} prime(i)*prime(1 + (i+k) mod n).

A337327 Maximum value of the cyclic self-convolution of the first n terms of the characteristic function of primes.

Original entry on oeis.org

0, 1, 2, 2, 3, 2, 4, 3, 3, 3, 4, 4, 6, 5, 4, 4, 6, 5, 8, 7, 6, 6, 8, 7, 8, 7, 6, 6, 8, 7, 10, 9, 8, 8, 8, 8, 10, 9, 8, 8, 10, 10, 12, 12, 10, 11, 12, 12, 12, 13, 12, 12, 14, 13, 14, 13, 12, 12, 12, 12, 14, 13, 12, 13, 12, 14, 14, 15, 12, 14, 14, 16, 16, 18
Offset: 1

Views

Author

Andres Cicuttin, Aug 23 2020

Keywords

Examples

			The primes among the first 5 positive integers (1,2,3,4,5) are 2, 3, and 5, then the corresponding characteristic function of primes is (0,1,1,0,1) (see A010051) and the corresponding five possible cyclic self-convolutions are the dot products between (0,1,1,0,1) and the rotations of its mirrored version as shown below:
  (0,1,1,0,1).(1,0,1,1,0) = 0*1 + 1*0 + 1*1 + 0*1 + 1*0 = 1,
  (0,1,1,0,1).(0,1,0,1,1) = 0*0 + 1*1 + 1*0 + 0*1 + 1*1 = 2,
  (0,1,1,0,1).(1,0,1,0,1) = 0*1 + 1*0 + 1*1 + 0*0 + 1*1 = 2,
  (0,1,1,0,1).(1,1,0,1,0) = 0*1 + 1*1 + 1*0 + 0*1 + 1*0 = 1,
  (0,1,1,0,1).(0,1,1,0,1) = 0*0 + 1*1 + 1*1 + 0*0 + 1*1 = 3.
Then a(5)=3 because 3 is the maximum among the five values.
		

Crossrefs

Programs

  • Mathematica
    b[n_]:=Table[If[PrimeQ[i],1,0],{i,1,n}];
    Table[Max@Table[b[n].RotateRight[Reverse[b[n]],j],{j,0,n-1}],{n,1,100}]
  • PARI
    a(n) = vecmax(vector(n, k, sum(i=1, n, isprime(n-i+1)*isprime(1+(i+k)%n)))); \\ Michel Marcus, Aug 26 2020

A337802 Minimum value of the cyclic self-convolution of the first n terms of the characteristic function of primes.

Original entry on oeis.org

0, 0, 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, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Andres Cicuttin, Sep 22 2020

Keywords

Comments

In the first 1000 terms, a(n) = 1 only for n = 3, 5, 7, 11, 13, 17, 19, 23, 31, 43, 47, 61, 73, 107, 109, 113, 181, 199, and 467.
Is there an index k such that a(n) = 0 for n > k ?

Examples

			The primes among the first 5 positive integers (1,2,3,4,5) are 2, 3, and 5, then the corresponding characteristic function of primes is (0,1,1,0,1) (see A010051) and the corresponding five possible cyclic self-convolutions are the dot products between (0,1,1,0,1) and the rotations of its mirrored version as shown below:
  (0,1,1,0,1).(1,0,1,1,0) = 0*1 + 1*0 + 1*1 + 0*1 + 1*0 = 1,
  (0,1,1,0,1).(0,1,0,1,1) = 0*0 + 1*1 + 1*0 + 0*1 + 1*1 = 2,
  (0,1,1,0,1).(1,0,1,0,1) = 0*1 + 1*0 + 1*1 + 0*0 + 1*1 = 2,
  (0,1,1,0,1).(1,1,0,1,0) = 0*1 + 1*1 + 1*0 + 0*1 + 1*0 = 1,
  (0,1,1,0,1).(0,1,1,0,1) = 0*0 + 1*1 + 1*1 + 0*0 + 1*1 = 3.
Then a(5)=1 because 1 is the minimum among the five values.
		

Crossrefs

Programs

  • Mathematica
    b[n_] := Table[If[PrimeQ[i], 1, 0], {i, 1, n}];
    Table[Min@Table[b[n].RotateRight[Reverse[b[n]], j], {j, 0, n - 1}], {n, 1, 100}]
  • PARI
    a(n) = vecmin(vector(n, k, sum(i=1, n, isprime(n-i+1)*isprime(1+(i+k)%n)))); \\ Michel Marcus, Sep 23 2020

A294172 Maximum value of the cyclic convolution of the first n positive integers with themselves.

Original entry on oeis.org

1, 5, 13, 28, 50, 83, 126, 184, 255, 345, 451, 580, 728, 903, 1100, 1328, 1581, 1869, 2185, 2540, 2926, 3355, 3818, 4328, 4875, 5473, 6111, 6804, 7540, 8335, 9176, 10080, 11033, 12053, 13125, 14268, 15466, 16739, 18070, 19480, 20951, 22505, 24123, 25828, 27600
Offset: 1

Views

Author

Andres Cicuttin, Feb 10 2018

Keywords

Comments

Conjecture: a(n) = (n*(13 + 3*(-1)^n + 24*n + 14*n^2))/48, and then lim_{n -> infinity} a(n)/n^3 = 7/24.
The conjectured formula is true. See links. - Sela Fried, Aug 13 2024.

Examples

			For n = 4, the four possible cyclic convolutions of the first four positive integers with themselves are:
(1,2,3,4).(4,3,2,1) = 1*4 + 2*3 + 3*2 + 4*1 = 4 + 6 + 6 + 4 = 20,
(1,2,3,4).(3,2,1,4) = 1*3 + 2*2 + 3*1 + 4*4 = 3 + 4 + 3 + 16 = 26,
(1,2,3,4).(2,1,4,3) = 1*2 + 2*1 + 3*4 + 4*3 = 2 + 2 + 12 + 12 = 28,
(1,2,3,4).(1,4,3,2) = 1*1 + 2*4 + 3*3 + 4*2 = 1 + 8 + 9 + 8 = 26,
then a(4)=28 because 28 is the maximum among the four values.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Max[Table[Range[n].RotateRight[Reverse[Range[n]], k], {k, 0, n - 1}]];
    Table[a[n], {n, 1, 45}]
  • PARI
    a(n) = vecmax(vector(n, k, sum(i=1, n, (n-i+1)*(1+(i+k) % n)))); \\ Michel Marcus, Feb 11 2018

Formula

a(n) = Max {x; x=Sum_{i=1..n}(n-i+1)*(1+(i+k) mod n); for k=1..n}.
Conjectures from Colin Barker, Feb 11 2018: (Start)
G.f.: x*(1 + 3*x + 2*x^2 + x^3) / ((1 - x)^4*(1 + x)^2).
a(n) = 2*a(n-1) + a(n-2) - 4*a(n-3) + a(n-4) + 2*a(n-5) - a(n-6) for n>6.
(End)

A338132 List of lengths of subsequences of the characteristic function of those primes for which the minimum cyclic self-convolution is 1. Also n such that A337802(n)=1.

Original entry on oeis.org

3, 5, 7, 11, 13, 17, 19, 23, 31, 43, 47, 61, 73, 107, 109, 113, 181, 199, 467
Offset: 1

Views

Author

Andres Cicuttin, Oct 11 2020

Keywords

Comments

Is this sequence finite?

Crossrefs

Programs

  • Mathematica
    b[n_] := Table[If[PrimeQ[i], 1, 0], {i, 1, n}];
    tab = Table[Min@Table[b[n].RotateRight[Reverse[b[n]], j], {j, 0, n - 1}], {n, 1, 2^12}]; (* to explore the first 2^12 subsequences *)
    Flatten[Position[tab, 1]]
Showing 1-7 of 7 results.