OFFSET
1,3
COMMENTS
Concatenations of consecutive entries of A112798. - R. J. Mathar, Feb 09 2009
The old entry with this A-number was a duplicate of A082467.
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
EXAMPLE
n = 2 = first prime, a(2) = 1.
n = 3 = second prime, a(3) = 2.
n = 4 = 2*2 -> 1,1 -> 11, so a(4) = 11.
n = 6 = 2*3 -> 1,2 -> 12, so a(6) = 12.
n = 12 = 2*2*3 -> 1,1,2 -> 112, so a(12) = 112.
MAPLE
# Maple program from R. J. Mathar, Feb 08 2009: (Start)
cat2 := proc(a, b) a*10^(max(1, ilog10(b)+1))+b ; end:
A049084 := proc(p) if isprime(p) then numtheory[pi](p) ; else 0 ; fi; end:
A087712 := proc(n) local pf, a, p, ex ; if isprime(n) then A049084(n) ; elif n = 1 then 1 ; else pf := ifactors(n)[2] ; a := 0 ; for p in pf do for ex from 1 to op(2, p) do a := cat2(a, A049084(op(1, p)) ) ; od: od: fi; end:
seq(A087712(n), n=1..140); # (End)
# (Maple program from David Applegate and N. J. A. Sloane, Feb 09 2009)
with(numtheory):
f := proc(n) local t1, v, r, x, j;
if (n = 1) then return 1; end if;
t1 := ifactors(n): v := 0;
for x in op(2, t1) do r := pi(x[1]):
for j from 1 to x[2] do
v := v * 10^length(r) + r;
end do; end do; v; end proc;
MATHEMATICA
f[n_] := If[n == 1, 1, FromDigits@ Flatten[ IntegerDigits@# & /@ (PrimePi@# & /@ Flatten[ Table[ First@#, {Last@#}] & /@ FactorInteger@ n])]]; Array[f, 61] (* Robert G. Wilson v, Jun 06 2011 *)
PROG
(Haskell)
a087712 1 = 1
a087712 n = read $ concatMap (show . a049084) $ a027746_row n :: Integer
-- Reinhard Zumkeller, Oct 03 2012
(Python)
from sympy import factorint, primepi
def a(n):
if n == 1: return 1
return int("".join(str(primepi(p))*e for p, e in factorint(n).items()))
print([a(n) for n in range(1, 62)]) # Michael S. Branicky, Oct 01 2024
CROSSREFS
KEYWORD
AUTHOR
Eric Angelini, Feb 02 2009
EXTENSIONS
More terms from R. J. Mathar (Feb 08 2009) and independently from David Applegate and N. J. A. Sloane, Feb 09 2009
STATUS
approved