J - 87 char
A naive attempt at this in J. No use of the standard library, though I doubt it would get any shorter by using that.
((sad`happy{~1 e.(,[:+/@:*:,.&.":@{:)^:(1-{:e.}:)^:_);@,' ';'gtv]non-prime'}.~4+4*1&p:)
'((ad`app{~1 .(,[:+/@:*:,.&.":@{:)^:(1-{:.}:)^:_);@, ;onprm}.~4+4*1&p:)']'eighty-seven'
('(ad`app{~1 .(,[:+/@:*:,.&.:@{:)^:(1-{:.}:)^:);@, ;onprm}.~4+4*1&p:']'eighty-seven'"_)
The line on the top is a verb taking an integer and diagnosing its happiness and primality as an output string. The second line is an expression returning the string eighty-seven, while the third is a constant function doing the same. I included both because they were both possible and because I don't know what the ruling will be on function answers as opposed to program ones, and J doesn't have such a thing as no-argument functions—you just give a function a dummy argument.
We lose most of the chars checking for happiness. (,[:+/@:*:,.&.":@{:) is the main body that sums the squares of the digits of a number, and (1-{:e.}:) is the test of whether that number has occurred yet. sad`happy{~1 e. turns this into a word result, and we attach that to the front of the string non-prime, potentially snipping off four characters if the number was actually prime.
In the anagram we just hide all the bits that aren't 'eighty-seven' in a string that we ignore. I could do better if J had more letters to reuse, but it doesn't, so oh well.
/*program1*/program2and thenprogram1/*program2*/? I think you should disallow comments. \$\endgroup\$