Skip to main content
added 10 characters in body
Source Link
ugoren
  • 17.6k
  • 5
  • 54
  • 75

C, 57 53  50 4040 39 bytes

The rules are somewhat confusing, I do hope I read them correctly.
Works on 32bit platforms only.

m="E=mc^2"; main(c){ m="E=mc^2",c=-1u/2; main(){ puts(m*c*c); } 

cc equals 2^31-1, so c*c equals 1 modulo 2^32. Therefore m*c*c == m (mod 2^32).
The -1u/2 constant and puts are hvd's suggestions.

C, 57 5350 40 bytes

The rules are somewhat confusing, I do hope I read them correctly.
Works on 32bit platforms only.

m="E=mc^2"; main(c){ c=-1u/2; puts(m*c*c); } 

cc equals 2^31-1, so c*c equals 1 modulo 2^32. Therefore m*c*c == m (mod 2^32).
The -1u/2 constant and puts are hvd's suggestions.

C, 57 53  50 40 39 bytes

The rules are somewhat confusing, I do hope I read them correctly.
Works on 32bit platforms only.

m="E=mc^2",c=-1u/2; main(){ puts(m*c*c); } 

cc equals 2^31-1, so c*c equals 1 modulo 2^32. Therefore m*c*c == m (mod 2^32).
The -1u/2 constant and puts are hvd's suggestions.

deleted 213 characters in body
Source Link
ugoren
  • 17.6k
  • 5
  • 54
  • 75

C, 57 53 5050 40 bytes

The rules are somewhat confusing, I do hope I read them correctly.
Works on 32bit platforms only.

m="E=mc^2"; main(c){ mc=-1u/=4; c=2;2; printfputs("%s\n",m*c*c); } 

Only works on 32bit platforms.

Assumes the address of sc is a multiple of 4c equals 2^31-1, which is quite likely to be trueso c*c equals 1 modulo 2^32. The following program is more robust, but longerTherefore m*c*c == m (58 bytesmod 2^32). It works because
The 954437177*9-1u/2 is 1 modulo 2^32constant and puts are hvd's suggestions.

m="E=mc^2"; main(c){ m*=954437177; c=3; printf("%s\n",m*c*c); } 

C, 57 53 50 bytes

The rules are somewhat confusing, I do hope I read them correctly.

m="E=mc^2"; main(c){ m/=4; c=2; printf("%s\n",m*c*c); } 

Only works on 32bit platforms.

Assumes the address of s is a multiple of 4, which is quite likely to be true. The following program is more robust, but longer (58 bytes). It works because 954437177*9 is 1 modulo 2^32.

m="E=mc^2"; main(c){ m*=954437177; c=3; printf("%s\n",m*c*c); } 

C, 57 5350 40 bytes

The rules are somewhat confusing, I do hope I read them correctly.
Works on 32bit platforms only.

m="E=mc^2"; main(c){ c=-1u/2; puts(m*c*c); } 

cc equals 2^31-1, so c*c equals 1 modulo 2^32. Therefore m*c*c == m (mod 2^32).
The -1u/2 constant and puts are hvd's suggestions.

added 180 characters in body
Source Link
ugoren
  • 17.6k
  • 5
  • 54
  • 75

C, 57 5353 50 bytes

The rules are somewhat confusing, I do hope I read them correctly.

s="E=mc^2",m;m="E=mc^2"; main(c){ m=sm/4;=4; c=2; printf("%s\n",m*c*c); } 

Only works on 32bit platforms.
Assumes

Assumes the address of s is a multiple of 4, which is quite likely to be true. The following program is more robust, but longer (this can be fixed for 758 bytes, using). It works because m=s;c=2147483647;954437177*9) is 1 modulo 2^32.

m="E=mc^2"; main(c){ m*=954437177; c=3; printf("%s\n",m*c*c); } 

C, 57 53 bytes

The rules are somewhat confusing, I do hope I read them correctly.

s="E=mc^2",m; main(c){ m=s/4; c=2; printf("%s\n",m*c*c); } 

Only works on 32bit platforms.
Assumes the address of s is a multiple of 4, which is quite likely to be true (this can be fixed for 7 bytes, using m=s;c=2147483647;).

C, 57 53 50 bytes

The rules are somewhat confusing, I do hope I read them correctly.

m="E=mc^2"; main(c){ m/=4; c=2; printf("%s\n",m*c*c); } 

Only works on 32bit platforms.

Assumes the address of s is a multiple of 4, which is quite likely to be true. The following program is more robust, but longer (58 bytes). It works because 954437177*9 is 1 modulo 2^32.

m="E=mc^2"; main(c){ m*=954437177; c=3; printf("%s\n",m*c*c); } 
added 62 characters in body
Source Link
ugoren
  • 17.6k
  • 5
  • 54
  • 75
Loading
added 8 characters in body
Source Link
ugoren
  • 17.6k
  • 5
  • 54
  • 75
Loading
Source Link
ugoren
  • 17.6k
  • 5
  • 54
  • 75
Loading