login
a(n) is the smallest index k such that the subsequence b(k), b(k+1),..., b(k+n-1) is a palindrome of length n, where b(k) = prime(k) mod 6 = A039704(k).
2

%I #30 Mar 19 2026 20:03:52

%S 1,9,3,8,3,30,3,29,16,87,23,86,22,99,140,98,140,717,140,716,140,715,

%T 139,714,3934,12862,3933,26993,5778,26992,20246,348411,20245,488970,

%U 20244,488969,20243,488968,76776,1822976,76775,1822975,76774,3540352,76773,10884806,5673605,19624687,5673604

%N a(n) is the smallest index k such that the subsequence b(k), b(k+1),..., b(k+n-1) is a palindrome of length n, where b(k) = prime(k) mod 6 = A039704(k).

%C Conjecture: There exist infinitely many palindromes of every length in the sequence of residues of primes modulo 6.

%C The aim of this sequence is to study the local symmetries of the sequence A039704. To do this, we identify palindromes in subsequences of A039704.

%H Sean A. Irvine, <a href="/A394059/b394059.txt">Table of n, a(n) for n = 1..59</a>

%e Initial solutions:

%e n a(n) palindrome

%e --------------------------------------------

%e 1 1 [1]

%e 2 9 [5, 5]

%e 3 3 [5, 1, 5]

%e 4 8 [1, 5, 5, 1]

%e 5 3 [5, 1, 5, 1, 5]

%e 6 30 [5, 1, 5, 5, 1, 5]

%e 7 3 [5, 1, 5, 1, 5, 1, 5]

%e 8 29 [1, 5, 1, 5, 5, 1, 5, 1]

%e 9 16 [5, 5, 1, 1, 5, 1, 1, 5, 5]

%e 10 87 [5, 1, 5, 1, 5, 5, 1, 5, 1, 5]

%e 11 23 [5, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5]

%e 12 86 [5, 5, 1, 5, 1, 5, 5, 1, 5, 1, 5, 5]

%p with(numtheory):

%p Nmax := 50: Pmax := 500000:

%p b := Array(1..Pmax):

%p for k from 1 to Pmax do b[k] := irem(ithprime(k),6) end do:

%p a := Array(1..Nmax, fill=infinity):

%p for k from 1 to Pmax do

%p r := 0:

%p while k-r >=1 and k+r <= Pmax and b[k-r]=b[k+r] do

%p n := 2*r+1: start := k-r:

%p if n <= Nmax and start < a[n] then a[n] := start: end if:

%p r := r+1:

%p end do:

%p r := 0:

%p while k-r >=1 and k+r+1 <= Pmax and b[k-r]=b[k+r+1] do

%p n := 2*r+2: start := k-r:

%p if n <= Nmax and start < a[n] then a[n] := start: end if:

%p r := r+1:

%p end do:

%p end do:

%p seq(a[n], n=1..Nmax);

%o (PARI) a(n, v) = for (i=1, #v-n, my(w = vector(n, k, v[i+k-1])); if (Vecrev(w) == w, return(i)););

%o lista(nn) = my(v = primes(nn) % 6); for (n=1, 50, my(x = a(n, v)); if (x, print1(x, ", "), return));

%o lista(10^7) \\ _Michel Marcus_, Mar 10 2026

%Y Cf. A039704, A393703.

%K nonn

%O 1,2

%A _Michel Lagneau_, Mar 09 2026

%E More terms from _Michel Marcus_, Mar 10 2026