Pair-golfing Twin primes and the Collatz sequence

CJam, 24 + 17 = 41 42

Collatz program:

ri2*{:N2%N3*)N2/?__p(}g;

Twin primes program:

ri_2+]{:)_{mp}/&_+((}gS*

Both take input from STDIN and print space/newline separated numbers to STDOUT

Try them online here


CJam, 25 + 16 = 41

Collatz program:

l~2*{_2%{3*)}{2/}?_p_(}g;

Twin primes program:

l~_2+]{:)_{mp}/&!_&}gS*

Test it here.

I just golfed both of them for now. I'll see if I can reduce the score somehow.


Pyth, 18 + 13 = 31

Collatz Sequence:

QWtQ=Q@,/Q2h*Q3QQ

Twin Primes:

=Qf!ttP*T+T2hQQ+Q2

Try it here.

Some ideas thanks to FryAmTheEggman.