A new dual colorimetric and fluorescent receptor L, antipyrine-based chemosensor, was synthesized and characterized by UV–Vis absorption and fluorescence spectroscopic studies. The binding behavior of the chemosensor L toward Cu2+ and Zn2+ ions in an aqueous medium was investigated by UV–Vis absorption, 1HNMR and fluorescence spectroscopic studies. Benesi-Hildebrand plot is used to calculate the binding affinity. Based on the UV–Vis titration of receptor L, the 1:1 stoichiometry between L and M2+ (M2+= Cu2+ or Zn2+) is obtained. The detection limits (obtained by the 3σ method) of compound L are 4.23 × 10−6 mol L−1 for Cu2+ and 2.41 × 10−6 mol L−1 for Zn2+. The receptor L-Zn2+ can act as a highly selective sensor for H2PO4− ions over other anionic species (F−, Cl−, Br−, I−, NO3−, CN−, HSO4−, ClO4− and OAC−) in an aqueous medium. According to the changes in absorption and emission wavelengths and visual color changes with two sequential ionic inputs (Cu2+ and Zn2+), it is clear that the receptor behavior can mimic the arithmetic functions of XOR, INH1, INH2, XNOR, OR, NOR and IMP logic gates and complex logic circuits such as comparator and half subtractor with a single molecule. The ‘novel’ dinuclear Zn(II) complex could be used as a colorimetric fluorescent H2PO4− (Pi) chemosensor. By utilizing Cu2+, Zn2+ and H2PO4− ions as the inputs, a new combinational logic circuit with three different logic gates (OR, NOT, and AND) has been constructed.