A109548 Primes of the form aaaa...aa1 where a is 1, 2, 3, 4 or 5.
11, 31, 41, 331, 2221, 3331, 4441, 33331, 333331, 3333331, 33333331, 44444444441, 555555555551, 5555555555551, 222222222222222221, 333333333333333331, 1111111111111111111, 11111111111111111111111
Offset: 1
Keywords
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..38
Programs
-
Mathematica
d[n_] = Mod[n, 6] a = Flatten[Table[Sum[d[k]*10^i, {i, 1, m}] + 1, {m, 1, 50}, {k, 1, 5}]] b = Flatten[Table[If[PrimeQ[a[[i]]] == True, a[[i]], {}], {i, 1, Length[a]}]] Select[FromDigits/@Flatten[Table[PadLeft[{1},i,#]&/@{1,2,3,4,5},{i,2,80}],1],PrimeQ[#]&] (* Vincenzo Librandi, Dec 12 2011 *)
Formula
d=1, 2, 3, 4, 5 a(n) = if prime then Sum[d*10^i, {i, 1, m}] + 1