login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Binary representation of n if n is prime, otherwise the ternary representation of n.
0

%I #6 Apr 19 2015 16:54:05

%S 1,10,11,11,101,20,111,22,100,101,1011,110,1101,112,120,121,10001,200,

%T 10011,202,210,211,10111,220,221,222,1000,1001,11101,1010,11111,1012,

%U 1020,1021,1022,1100,100101,1102,1110,1111,101001,1120,101011,1122,1200

%N Binary representation of n if n is prime, otherwise the ternary representation of n.

%e For n = 7 we have 111 or 7 in base 2. For 8 we have 22 which is 8 in base 3.

%t Table[If[PrimeQ[n],FromDigits[IntegerDigits[n,2]], FromDigits[ IntegerDigits[ n,3]]],{n,50}] (* _Harvey P. Dale_, Apr 19 2015 *)

%K base,nonn

%O 1,2

%A _Cino Hilliard_, Aug 29 2004