OFFSET
1,1
COMMENTS
Primes that are the sum of four distinct powers of ten (A038446). - Jeppe Stig Nielsen, May 18 2023
LINKS
Jeppe Stig Nielsen, Table of n, a(n) for n = 1..10000 (terms 1..1000 from T. D. Noe)
MAPLE
for d from 4 to 18 do for c from 0 to 2^d-1 do bdgs := convert(c, base, 2) ; if add(i, i=bdgs) = 3 then p := 10^d+add(op(i, bdgs)*10^(i-1), i=1..nops(bdgs)) ; if isprime(p) then printf("%d, ", p) ; fi; fi; od: od: # R. J. Mathar, Mar 06 2009
MATHEMATICA
Flatten[Select[FromDigits/@Permutations[Join[{1, 1, 1, 1}, PadRight[{}, 7, 0]]], PrimeQ]] // Union (* Harvey P. Dale, May 09 2019 *)
PROG
(PARI) for(n=0, 10, forprime(p=10^n, (10^(n+1)-1)/9, if(vecmax(digits(p))==1, if(sumdigits(p)==4, print1(p, ", "))))) \\ Felix Fröhlich, Nov 19 2014
(PARI) my(M=20); for(i=3, M, for(j=2, i-1, for(k=1, j-1, my(p=10^i+10^j+10^k+1); isprime(p)&&print1(p, ", ")))) \\ Jeppe Stig Nielsen, May 18 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Lekraj Beedassy, Mar 04 2009
EXTENSIONS
Extended by numerous authors, Mar 06 2009
STATUS
approved