login
Concatenate p p times, where p runs through the primes.
0

%I #30 Dec 28 2023 07:08:22

%S 22,333,55555,7777777,1111111111111111111111,

%T 13131313131313131313131313,1717171717171717171717171717171717,

%U 19191919191919191919191919191919191919,2323232323232323232323232323232323232323232323

%N Concatenate p p times, where p runs through the primes.

%F log a(n) ~ (log 10)n log n. - _Charles R Greathouse IV_, Sep 20 2012

%e For each prime number p we write down 'p' p times.

%e 2 -> 22

%e 3 -> 333

%e 5 -> 55555

%e ... -> ...

%p a:= n-> (p-> parse(cat(p$p)))(ithprime(n)):

%p seq(a(n), n=1..10); # _Alois P. Heinz_, Jul 07 2016

%t Table[FromDigits[Flatten[IntegerDigits/@PadRight[{},p,p]]],{p,Prime[Range[10]]}] (* _Harvey P. Dale_, Jul 07 2022 *)

%o (PARI) a(n) = {p = prime(n); s = Str(p); ss = ""; for (k=1, p, ss = concat(ss, s);); eval(ss);} \\ _Michel Marcus_, Jul 02 2016

%Y Cf. A000040, A000461.

%K nonn,base,easy

%O 1,1

%A _Patrick De Geest_, Jul 15 1999