cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A087712 a(1) = 1; if n = k-th prime, a(n) = k; otherwise write all prime factors of n in nondecreasing order, replace each prime with its rank, and concatenate the ranks.

This page as a plain text file.
%I A087712 #35 Oct 01 2024 13:17:05
%S A087712 1,1,2,11,3,12,4,111,22,13,5,112,6,14,23,1111,7,122,8,113,24,15,9,
%T A087712 1112,33,16,222,114,10,123,11,11111,25,17,34,1122,12,18,26,1113,13,
%U A087712 124,14,115,223,19,15,11112,44,133,27,116,16,1222,35,1114,28,110,17,1123,18
%N A087712 a(1) = 1; if n = k-th prime, a(n) = k; otherwise write all prime factors of n in nondecreasing order, replace each prime with its rank, and concatenate the ranks.
%C A087712 Concatenations of consecutive entries of A112798. - _R. J. Mathar_, Feb 09 2009
%C A087712 The old entry with this A-number was a duplicate of A082467.
%H A087712 Reinhard Zumkeller, <a href="/A087712/b087712.txt">Table of n, a(n) for n = 1..10000</a>
%e A087712 n = 2 = first prime, a(2) = 1.
%e A087712 n = 3 = second prime, a(3) = 2.
%e A087712 n = 4 = 2*2 -> 1,1 -> 11, so a(4) = 11.
%e A087712 n = 6 = 2*3 -> 1,2 -> 12, so a(6) = 12.
%e A087712 n = 12 = 2*2*3 -> 1,1,2 -> 112, so a(12) = 112.
%p A087712 # Maple program from _R. J. Mathar_, Feb 08 2009: (Start)
%p A087712 cat2 := proc(a,b) a*10^(max(1,ilog10(b)+1))+b ; end:
%p A087712 A049084 := proc(p) if isprime(p) then numtheory[pi](p) ; else 0 ; fi; end:
%p A087712 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:
%p A087712 seq(A087712(n),n=1..140); # (End)
%p A087712 # (Maple program from _David Applegate_ and _N. J. A. Sloane_, Feb 09 2009)
%p A087712 with(numtheory):
%p A087712 f := proc(n) local t1, v, r, x, j;
%p A087712 if (n = 1) then return 1; end if;
%p A087712 t1 := ifactors(n): v := 0;
%p A087712 for x in op(2,t1) do r := pi(x[1]):
%p A087712 for j from 1 to x[2] do
%p A087712 v := v * 10^length(r) + r;
%p A087712 end do; end do; v; end proc;
%t A087712 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 *)
%o A087712 (Haskell)
%o A087712 a087712 1 = 1
%o A087712 a087712 n = read $ concatMap (show . a049084) $ a027746_row n :: Integer
%o A087712 -- _Reinhard Zumkeller_, Oct 03 2012
%o A087712 (Python)
%o A087712 from sympy import factorint, primepi
%o A087712 def a(n):
%o A087712     if n == 1: return 1
%o A087712     return int("".join(str(primepi(p))*e for p, e in factorint(n).items()))
%o A087712 print([a(n) for n in range(1, 62)]) # _Michael S. Branicky_, Oct 01 2024
%Y A087712 See A098282 for lengths of trajectories. Cf. A077960, A156055.
%Y A087712 Cf. A027746, A049084.
%K A087712 nonn,base,look
%O A087712 1,3
%A A087712 _Eric Angelini_, Feb 02 2009
%E A087712 More terms from _R. J. Mathar_ (Feb 08 2009) and independently from _David Applegate_ and _N. J. A. Sloane_, Feb 09 2009