A289667 Concatenate prime factorization written in base 3, convert back to decimal.
1, 2, 3, 8, 5, 21, 7, 21, 11, 23, 11, 75, 13, 25, 32, 22, 17, 65, 19, 77, 34, 65, 23, 192, 17, 67, 30, 79, 29, 194, 31, 23, 92, 71, 52, 227, 37, 73, 94, 194, 41, 196, 43, 227, 104, 77, 47, 201, 23, 71, 98, 229, 53, 192, 146, 196, 100, 191, 59, 680, 61, 193, 106, 24
Offset: 1
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..10000
Programs
-
Maple
# take ifsSorted from A080670 A289667 := proc(n) local Ldgs, p,eb,pb,b ; b := 3; if n = 1 then return 1; end if; Ldgs := [] ; for p in ifsSorted(n) do pb := convert(op(1,p),base,b) ; Ldgs := [op(pb),op(Ldgs)] ; if op(2, p) > 1 then eb := convert(op(2,p),base,b) ; Ldgs := [op(eb),op(Ldgs)] ; end if; end do: add( op(e,Ldgs)*b^(e-1),e=1..nops(Ldgs)) ; end proc: seq(A289667(n),n=1..30) ; # R. J. Mathar, Aug 05 2017
-
Mathematica
Table[FromDigits[#, 3] &@ Flatten@ Map[IntegerDigits[#, 3] &, FactorInteger[n] /. {p_, e_} /; p > 0 :> If[e == 1, p, {p, e}]], {n, 64}] (* Michael De Vlieger, Jul 29 2017 *)
-
PARI
a(n) = {if (n==1, return(1)); f = factor(n); s = []; for (i=1, #f~, s = concat(s, digits(f[i, 1], 3)); if (f[i, 2] != 1, s = concat(s, digits(f[i, 2], 3)));); fromdigits(s, 3);} \\ Michel Marcus, Jul 27 2017
Extensions
More terms from Michel Marcus, Jul 27 2017
Comments