top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Print the first 128 prime numbers without using any reserved words.

+4 votes
337 views

Requirements:

1.No input should be processed, and the output should be in the form of 2 3 5 7 11 13 ... etc.
2. No reserved words in the language are used at all
3.The language should at least allow structured programming, and have reserved words (otherwise point 2 would be moot).

posted Feb 17, 2014 by Muskan

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+3 votes
 
Best answer
main(i){i<9?main(2953216):i>4097?--i&4094?i/4096%(i%4096)?main(i):
main((i/4096-1)*4097):printf("%d\n",i>>12,main((i/4096-1)*4097)):0;}

All it uses is printf and main with a single argument.

answer Feb 17, 2014 by Asmita Agrawal
Similar Questions
+2 votes

How will we print numbers from 1 to N without using loop or recursion?

+2 votes

it is illegal to share some certain prime numbers in US and if you do so,you will get arrested.Follow this link to get more details :
https://www.youtube.com/watch?v=LnEyjwdoj7g
My question is : it is very easy to find multiplication of two prime numbers but tough to get what are the prime numbers which multiplication results this number . Example : 7*11= 77 but you are given 77 = ? * ? where ?= two prime numbers only (ans = 7 and 11).Another example : 11*13= 143 but you need to solve it for 143 and you output : 11 13
So I need a program ,efficient one, to get solutions to such type of mathematical problem.
Adding more examples:
input:1. 21 -> 3,7
2. 189 -> 3,7,9
3.1363 -> 29,47 .... and if is not possible then print -1 example 1. 4 and its factors 2*2 where 2 is repeated so print -1
2. 9-> -1
3. 24->-1 ( prime factors are 2^3 * 3= 8*3 where 8 is not prime so print -1).
Thanks in advance.

+4 votes

How can we perform Sorting a list of strings without using any built-in sort method?

...