OFFSET
1,1
COMMENTS
No further terms below 5456. - Robert G. Wilson v, Feb 18 2004
Approximately 1/3rd of numbers of the form described in the definition have a digit sum which is a multiple of 3 and therefore they are not prime numbers and do not have to be otherwise tested for prime status. The indices (i.e., integer lengths) of the first few such numbers are 3, 11, 12, 14, 15, 18, 26, 27, 29, 30, 33, 41, 42, 44, 45, 48, 56, 57, . . . Those indices appear to satisfy a linear recurrence having signature (1, 0, 0, 0, 1, -1) and can also be derived from the expansion of g.f. = (3+8*x+x^2+2*x^3+x^4)/((-1+x)^2*(1+x+x^2+x^3+x^4)). - Harvey P. Dale, Dec 02 2018
EXAMPLE
1 is not a prime; 31 is a 2-digit prime, so 2 is a member.
531 is not prime, 7531 is not prime, 97531 is not prime, 197531 is not prime.
a(2)=58 because 5319753197531975319753197531975319753197531975319753197531 is prime and has 58 digits.
MATHEMATICA
s = 0; Do[s = s + 10^n*Switch[ Mod[n, 5], 0, 1, 1, 3, 2, 5, 3, 7, 4, 9]; If[ PrimeQ[s], Print[n + 1]], {n, 0, 2500}] (* Robert G. Wilson v, Feb 19 2004 *)
IntegerLength/@(Select[FromDigits/@Table[PadLeft[{}, n, {9, 7, 5, 3, 1}], {n, 100}], PrimeQ]) (* Harvey P. Dale, Nov 30 2018 *)
PROG
(PARI) test1(n)= s=0; for(i=0, n, \ if(Mod(i, 5)==0, s=s+1*10^i, \ if(Mod(i, 5)==1, s=s+3*10^i, \ if(Mod(i, 5)==2, s=s+5*10^i, \ if(Mod(i, 5)==3, s=s+7*10^i, \ if(Mod(i, 5)==4, s=s+9*10^i, \ )))))); return(s); for(j=0, 2000, if(isprime(test1(j)), print(j+1), print1(".")))
CROSSREFS
KEYWORD
hard,nonn,base
AUTHOR
mohammed bouayoun (bouyao(AT)wanadoo.fr), Feb 03 2004
EXTENSIONS
a(5)-a(7) from Michael S. Branicky, May 27 2023
STATUS
approved