Implement 'AND' function with 'XOR' function.


Hi, everybody!

I appreciate it if someone could tell me how to implement 'AND' function with 'XOR' function.

Best regards,



I'm almost 100% sure you can't. The XOR function can't tell the difference between '1,1' and '0,0' at it's inputs. Inverting the inputs/output in whatever combination makes a new gate with an XOR or XNOR function.

You can of course make and AND function from the following:


This is not as silly as it seems as in transistor logic a NOR gate can be smaller/faster than an AND gate (which is made from an NAND gate followed by an inverter).

Please feel free to correct me on any of the above if I have made an error.


It can also be accomplished with an OR and two XORs.

	| = OR  ^ = XOR

x ^ y ^ (x | y)

The logical reason an OR is required is that an XOR is derived from two ANDs, two NOTs, and an OR (or a logical equivalent thereof):

	(x & !y) | (!x & y)
So, if an AND is desired, the OR must be factored out which, of course, requires an OR operation.

What are you up to now ???????????



If you were to bu trying to build an AND function from XOR gates, then it is indeed possible.

Imagine an XOR gate with one input held in a logic 1 state. The gate then acts as an inverter. Similarly, if the input is held low it acts as a non-inverting buffer.

Using an additional 2 diodes, and a resistor allows you to "wire-AND" the outputs of two buffers, and then buffer the output.

Depending on the nature of the surrounding logic, you could even dispense with the XOR gates :-)

Possibly Related Threads...
Thread Author Replies Views Last Post
  HP50g: Writing a function that returns a function Chris de Castro 2 180 12-10-2013, 06:49 PM
Last Post: Han
  IFERR function on HP Prime Mic 2 168 12-02-2013, 01:33 AM
Last Post: cyrille de Brébisson
  HP Prime: Dirichlet's eta function recognized but not numerically evaluated Helge Gabert 0 94 11-16-2013, 03:41 PM
Last Post: Helge Gabert
  Possible bug with sqrt function in the HP prime Michael de Estrada 6 234 11-15-2013, 12:49 PM
Last Post: Michael de Estrada
  HP-41 MCODE: The Last Function - at last! Ángel Martin 0 104 11-08-2013, 05:11 AM
Last Post: Ángel Martin
  [Prime] any ideas for a undo function? Stefan Dröge (Germany) 8 300 11-04-2013, 04:37 PM
Last Post: Damien
  HP Prime 'where' function bluesun08 11 410 10-29-2013, 06:56 PM
Last Post: Joe Horn
  HP Prime - Defining a function bluesun08 5 225 10-23-2013, 02:43 PM
Last Post: Han
  How to save the definition of a CAS program or CAS function ? dg1969 3 168 10-19-2013, 01:48 PM
Last Post: dg1969
  HP PRIME Function parameters steindid 2 139 10-11-2013, 10:20 AM
Last Post: steindid

Forum Jump: