Tag Info

New answers tagged

1

Here's a functional approach without using loops: st[p_] := PrimeQ[Total @ IntegerDigits @ p + Range[-3, 1]] ~ AllTrue ~ Not // Not nextStubborn[p_] := NestWhile[NextPrime, NextPrime[p], st] stubbornList[n_] := NestList[nextStubborn, 2, n] // Rest stubbornList[100] (* {8999, 18899, 19889, 19979, 19997, 28979, 29789, 29879, 35999, 36899, *) (* 37799, ...


1

j = 1; While[ Or @@ (PrimeQ@({#-3,# - 2, # - 1, #, # + 1} &@(Total@ IntegerDigits[Prime[j]]))), j++] Prime[j] So 8999 has desired property: {#-3,# - 2, # - 1, #, # + 1} &@(Total@IntegerDigits[Prime[1117]])) yields:{32, 33, 34, 35, 36} for fun: query[u_] := Nor @@ PrimeQ[# + {-3, -2, -1, 0, 1} &@Total[IntegerDigits@u]] cand = ...



Top 50 recent answers are included