A287874 Concatenate prime factorization as in A080670, but write everything in binary.
1, 10, 11, 1010, 101, 1011, 111, 1011, 1110, 10101, 1011, 101011, 1101, 10111, 11101, 10100, 10001, 101110, 10011, 1010101, 11111, 101011, 10111, 101111, 10110, 101101, 1111, 1010111, 11101, 1011101, 11111, 10101, 111011, 1010001, 101111, 10101110, 100101
Offset: 1
Examples
a(1) = 1 by convention. a(2) = 10 (= 2 written in binary). a(4) = 1010 = concatenate(10,10), since 4 = 2^2 = 10[2] ^ 10[2]. a(6) = 1011 = concatenate(10,11), since 6 = 2*3 = 10[2] * 11[2]. a(8) = 1011 = concatenate(10,11), since 8 = 2^3 = 10[2] ^ 11[2].
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
f:= proc(n) local F, L, i; F:= map(op,subs(1=NULL, sort(ifactors(n)[2], (a,b) -> a[1] < b[1]))); F:= map(convert, F, binary); L:= map(length,F); L:= ListTools:-Reverse(ListTools:-PartialSums(ListTools:-Reverse(L))); add(F[i]*10^L[i+1],i=1..nops(F)-1)+F[-1]; end proc: f(1):= 1: map(f, [$1..100]); # Robert Israel, Jun 20 2017
-
Mathematica
fn[1] = 1; fn[n_] := FromDigits[Flatten[IntegerDigits[DeleteCases[Flatten[FactorInteger[n]], 1], 2]]]; Table[fn[n], {n, 37}] (* Robert Price, Mar 16 2020 *)
-
PARI
A287874(n)=if(n>1,fromdigits(concat(apply(binary,select(t->t>1,concat(Col(factor(n))~)))),10),1) \\ M. F. Hasler, Jun 21 2017
-
Python
from sympy import factorint def a(n): f=factorint(n) return 1 if n==1 else int("".join(bin(i)[2:] + bin(f[i])[2:] if f[i]!=1 else bin(i)[2:] for i in f)) print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 23 2017
Formula
Extensions
Edited by M. F. Hasler, Jun 21 2017
Comments