A247025 Lengths of prefixes of the infinite string of digits repeat(1379) that are prime.
2, 3, 7, 81, 223, 250, 255, 537, 543, 1042, 2103, 4285, 25015, 35361, 43525
Offset: 1
Examples
1 and 3 are the first two digits of the string, and 13 is prime. 13 has length 2, so 2 is a term. 137 is prime and three digits long, so 3 is a term. 1379137 is prime and seven digits long, so 7 is a term.
Programs
-
Magma
[n: n in [0..300] | IsPrime(Floor(1379/9999 * 10^n))]; // Vincenzo Librandi, Oct 17 2014
-
Mathematica
Select[Range[4300],PrimeQ[FromDigits[PadRight[{},#,{1,3,7,9}]]]&] (* The program generates the first 12 terms of the sequence. *) (* Harvey P. Dale, Jun 11 2024 *)
-
PARI
lista(nn) = {s = 0; digs = [1,3,7,9]; id = 1; for (n=1, nn, s = 10*s + digs[id]; if (isprime(s), print1(n, ", ")); id++; if (id==5, id = 1););} \\ Michel Marcus, Oct 11 2014
-
Python
from sympy import isprime from itertools import cycle it=cycle([1,3,7,9]) c=0 a=0 for i in it: c+=1 a*=10 a+=i if isprime(a): print(c)
Extensions
Edited. Name specified. Example reformulated. a(12) added (using R. Israel's formula). Keyword less and Crossreferences added. - Wolfdieter Lang, Nov 03 2014
a(13)-a(14) from Michael S. Branicky, May 29 2023
a(15) from Michael S. Branicky, Jun 13 2024
Comments