A356374 a(n) is the first prime that starts a string of exactly n consecutive primes that are in A347702.
131, 41, 11, 178909, 304290583, 8345111009
Offset: 1
Examples
a(3) = 11 because [11, 13, 17] is the first string of exactly 3 consecutive primes that are quasi-Niven numbers: 11 mod (1+1) = 1, 13 mod (1+3) = 1 and 17 mod (1+7) = 1, while the preceding prime 7 and the next prime 23 are not quasi-Niven.
Programs
-
Maple
filter:= proc(n) n mod convert(convert(n,base,10),`+`) = 1 end proc: V:= Vector(5): count:= 0: s:= 0: p:= 1: while count < 5 do p:= nextprime(p); if filter(p) then s:= s+1; if s = 1 then p0:= p fi elif s > 0 then if s <= 5 and V[s] = 0 then V[s]:= p0; count:= count+1 fi; s:= 0; fi od: convert(V,list);
-
Mathematica
seq[len_, pmax_] := Module[{s = Table[0, {len}], v = {}, p = 2, c = 0, pfirst = 2, i}, While[c < len && p < pmax, If[Divisible[p - 1, Plus @@ IntegerDigits[p]], AppendTo[v, p]; If[pfirst == 0, pfirst = p], i = Length[v]; v = {}; If[0 < i <= len && s[[i]] == 0, s[[i]] = pfirst]; pfirst = 0]; p = NextPrime[p]]; s]; seq[4, 10^6] (* Amiram Eldar, Aug 04 2022 *)
Extensions
a(5)-a(6) from Amiram Eldar, Aug 04 2022
Comments