## Binary subtraction with numbers in 2’s complement

How can i perform binary subtraction of two numbers that are already in 2’s complement? I have to subtract 01010011 from 10100110,both numbers are in 2’s complement. I know that 10100110 is -90,and 01010011 is 83,so the result should be -173. So if i use 8 bits that means that there’s overflow. But i don’t get how can i perform the subtraction when both the numbers are in 2’s complement. If i just perform the subtraction i get the same number 01010011. How do i show the result and that there’s overflow?

## Is the complement of this decision problem in $P$?

Are there any two primes that are NOT a factor of $$M$$ that multiply up to $$M$$?

Fact: Any two primes that multiply up to $$M$$. Must be factors of $$M$$!

Thus because of the fact above an $$O(1)$$ algorithm exists. It always outputs $$NO$$

## Complement

Are there any two primes that are a factor of $$M$$ that multiply up to $$M$$?

Fact: A complement of a decision problem does not always require to always return $$YES$$ or $$NO$$. It can be either one!

(eg. $$M$$ = 6 and two primes that multiply up to $$M$$ are $$3$$,$$2$$.)

Well, this I find interesting this is deciding $$Semi-Primes$$.

## Question

Shouldn’t $$Semi-Primes$$ be in $$P$$, because what was shown above?

## How to prove if P = NP if problem Π ϵ NP-complete and Problem complement Πc ϵ NP?

How to prove if P = NP if problem Π ϵ NP-complete and Problem complement Πc ϵ NP? OR P = NP if NPC intersects with Co-NPC

## Must a decision problem in $NP$ have a complement in $Co-NP$, if I can verify the solutions to in polynomial-time?

Goldbach’s Conjecture says every even integer $$>$$ $$2$$ can be expressed as the sum of two primes.

Let’s say $$N$$ is our input and its $$10$$. Which is an integer > 2 and is not odd.

## Algorithm

1.Create list of numbers from $$1,to~N$$

2.Use prime-testing algorithm for creating a second list of prime numbers

3.Use my 2_sum solver that allows you to use primes twice that sum up to $$N$$

for j in range(list-of-primes)):   if N-(list-of-primes[j]) in list-of-primes:    print('yes')    break 

4.Verify solution efficently

if AKS-primality(N-(list-of-primes[j])):     if AKS-primality(list-of-primes[j]):         print('Solution is correct') 

5.Output

yes 7 + 3 Solution is correct 

## Question

If the conjecture is true, then the answer will always be Yes. Does that mean it can’t be in $$Co-NP$$ because the answer is always Yes?

## Write a MIPS Program to perform the conversion of 32-bit sign/magnitude binary to 2s complement numbers?

So i have been working on this and this is what i got so far Please help me if i did it wrong or i can fix something here. Thank You.

$$LC0: .ascii “Enter %d bit binary value: 0”$$LC1: .ascii “Original binary = %s20” $$LC2: .ascii “Ones complement = %s20”$$LC3: .ascii “Twos complement = %s20” main: addiu $$sp,$$sp,-144 sw $$31,140($$sp) li $$5,32 # 0x20 lui$$4,%hi($$LC0) addiu$$4,$$4,%lo($$LC0) jal printf nop

    addiu   $$4,$$sp,24     jal     gets     nop      addiu   $$3,$$sp,24     addiu   $$2,$$sp,60     addiu   $$5,$$sp,92     li      $$6,49 # 0x31 li$$7,48                 # 0x30     li      $$9,49 # 0x31 li$$8,48                 # 0x30 

$$L4: lb$$4,0($$3) nop bne$$4,$$6,$$L2 nop

    b       $$L3 sb$$8,0($2)  $$L2: bne$$4,$$7,$$L3 nop  sb $$9,0($$2)  $$L3: addiu$$2,$$2,1 bne$$2,$$5,$$L4 addiu $$3,$$3,1  sb $$0,92($$sp) addiu $$4,$$sp,91 addiu $$2,$$sp,127 addiu $$5,$$sp,95 li $$8,1 # 0x1 li$$6,49 # 0x31 li $$7,48 # 0x30 li$$9,1 # 0x1 li $$11,49 # 0x31 li$$10,48 # 0x30  $$L8: lb$$3,0($$4) nop bne$$3,$$6,$$L5 nop  bne $$8,$$9,$  L6     nop      b       $$L7 sb$$10,0($2)  $$L5: bne$$3,$$7,$$L6 nop  bne $$8,$$9,$  L6     nop      sb      $$11,0($$2)     b       $$L7 move$$8,$0  $$L6: sb$$3,0($$2)$$L7: addiu $$2,$$2,-1 bne $$2,$$5,$$L8 addiu$$4,$ 4,-1

    sb      $$0,128($$sp)     addiu   $$5,$$sp,24     lui     $$4,%hi($$LC1)     addiu   $$4,$$4,%lo($LC1) jal printf nop addiu $$5,$$sp,60 lui $$4,%hi($$LC2) addiu $$4,$$4,%lo($  LC2)     jal     printf     nop      addiu   $$5,$$sp,96     lui     $$4,%hi($$LC3)     addiu   $$4,$$4,%lo($LC3) jal printf nop move $$2,$$0 lw $$31,140($$sp) nop j $$31 addiu$$sp,$  sp,144 

## What is the 2’s complement answer of 16.5?

According to this post it is saying Two’s complement is only for integers, but in Wolframalpha is is saying the Two’s complement of 16.5 is 0010000.1, how?

## Representation of -40 in 8bit computer using 2’s complement

What is the representation of -40 in a 8bit computer using 2’s complement intiger?

## Complement of a DFA wihtout final states

Let $$L_1=\{Q,\Sigma,q_0,\delta,Q\}$$ be a DFA that accepts a language $$L$$ and where all the states are also final states. If we want a DFA that accepts the complement of $$L$$, we swap its accepting states with its non-accepting states, that is $$\overline{L_1}=\{Q,\Sigma,q_0,\delta,Q-Q\}$$. In this case we have a DFA without final states. Is this still a DFA? Is it regular?

## proving that a turing machine which stops at every input and recognize the complement of L

i would like to prove that the deterministic TM M stops on every input and L(M) = L. Prove that there exists a deterministic TM M1 that stops on every input and recognizes the complement L of language L, that is L(M1) = L.

## There exists an algorithm to find grammar of complement of a language?

I’m wondering if there exists an algorithm to solve the following problem:

Given a grammar $$S$$ (regular, context-free, context-sensitive or irrestricted) of a language $$L$$, find a grammar $$S’$$ such as $$L=L^c$$.