login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

A338238
Minimum number of rotations for a second maximum cyclic autocorrelation of the first n terms of the characteristic function of primes.
3
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,4
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).
EXAMPLE
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.
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
CROSSREFS
KEYWORD
nonn
AUTHOR
Andres Cicuttin, Oct 17 2020
STATUS
approved