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.

A289667 Concatenate prime factorization written in base 3, convert back to decimal.

This page as a plain text file.
%I A289667 #15 Aug 05 2017 12:42:27
%S A289667 1,2,3,8,5,21,7,21,11,23,11,75,13,25,32,22,17,65,19,77,34,65,23,192,
%T A289667 17,67,30,79,29,194,31,23,92,71,52,227,37,73,94,194,41,196,43,227,104,
%U A289667 77,47,201,23,71,98,229,53,192,146,196,100,191,59,680,61,193,106,24
%N A289667 Concatenate prime factorization written in base 3, convert back to decimal.
%C A289667 A080670 is the base 10 version, A230625 is the binary version.
%H A289667 Michael De Vlieger, <a href="/A289667/b289667.txt">Table of n, a(n) for n = 1..10000</a>
%p A289667 # take ifsSorted from A080670
%p A289667 A289667 := proc(n)
%p A289667     local Ldgs, p,eb,pb,b ;
%p A289667     b := 3;
%p A289667     if n = 1 then
%p A289667         return 1;
%p A289667     end if;
%p A289667     Ldgs := [] ;
%p A289667     for p in ifsSorted(n) do
%p A289667         pb := convert(op(1,p),base,b) ;
%p A289667         Ldgs := [op(pb),op(Ldgs)] ;
%p A289667         if op(2, p) > 1 then
%p A289667             eb := convert(op(2,p),base,b) ;
%p A289667             Ldgs := [op(eb),op(Ldgs)] ;
%p A289667         end if;
%p A289667     end do:
%p A289667     add( op(e,Ldgs)*b^(e-1),e=1..nops(Ldgs)) ;
%p A289667 end proc:
%p A289667 seq(A289667(n),n=1..30) ; # _R. J. Mathar_, Aug 05 2017
%t A289667 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 *)
%o A289667 (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
%Y A289667 Cf. A080670, A195264, A230625, A230627.
%K A289667 nonn,base
%O A289667 1,2
%A A289667 _N. J. A. Sloane_, Jul 27 2017
%E A289667 More terms from _Michel Marcus_, Jul 27 2017