CRYPTO1 - The Bytelandian Cryptographer (Act I)

no tags 

The infamous Bytelandian Bit-eating Fanatic Organisation (BBFO for short) plans to launch an all-out denial-of-service attack on the Bytelandian McDecimal's fast food network by blocking the entrance to every restaurant with a camel (the purpose being to rid the Organisation of unhealthy competition, obviously). In a sly and perfidious move, the head cryptographer of BBFO decided to disclose the date and time of the planned attack to the management of McDecimal's, but in encrypted form (ha ha). He calculated the number of seconds from midnight 1970.01.01 GMT to the moment of attack, squared it, divided it by 4000000007 and sent the remainder by e-mail to McDecimal's. This made the original date impossible to decode.

Or did it?

*   *   *

You work as the head algorithmist at McDecimal's HQ and know nothing of what is happening in Byteland. Things are not going well. You are playing a quiet game of hearts against your computer and wondering why on earth Management are considering making you redundant. Suddenly, the CEO bursts into your office, saying:

- Look here, young man[lady]! I have this number and those guys claim it is supposed to be some date. I am giving you one second to tell me what it all means!

I am afraid you have no choice. You can't ask any further questions.

You just have to answer, now.

Input

The encrypted timestamp.

Output

The decrypted GMT time and date of attack, somewhere between 1970 and 2030, using standard 26 character formatting.

Example

Input:
1749870067

Output:
Sun Jun 13 16:20:39 2004

hide comments
Rahul: 2013-04-12 07:42:14

there are two soln to above problem 1087143639 and 2912856368. First one gives the output as Sun Jun 13 21:50:39 2004

Last edit: 2013-04-12 09:01:44
Ikhaduri: 2012-04-03 19:04:12

How is it even possible to solve this with TEXT??????

simon: 2011-05-27 15:22:47

I guess the answer is expected to be integer

Santiago Palacio: 2011-05-26 06:52:49

if there are multiple answers, how would we know which use? beacouse for the same number the answers could be, int theory, infinite.

George Bezerra [UnB]: 2011-02-25 03:30:21

@Nagoorkani A: x would be 1087143639 and not 1087136439 as you stated. f(x) given by the example is correct.

Nagoorkani A: 2011-02-12 14:35:35

encryption seems to be f(x) = x^2 mod p
the output of the example is Sun Jun 13 16:20:39 2004, which lets x be 1087136439, but then f(x) would be 2933335865 and not 1749870067 as indicated by the input!

Scott Nicholas: 2011-02-04 08:51:15

4000000007 is prime, so i guess trying to factor out some trials isn't going to help. thus, i'm stuck at brute-force. i'll have to come back to this one when it's earlier in the day. :)

Michael Foukarakis: 2010-12-20 07:11:41

Abhishek:

I think you need to look up the definition of quotient and remainder.

Last edit: 2010-12-20 07:11:54
.:: Jarv1s ::.: 2010-08-11 01:01:04

as the square of max timestamp(i.e. 3580269465600000000) is much larger than 4000000007,hence there can be more than one solutions for a decoded timestamp can exist.
e.g. if remainder=234;
4000000007*1+234
4000000007*2+234
then what will be the correct answer.How it can be solved within 1 sec.

Last edit: 2010-08-11 01:01:53
schiermike: 2010-01-21 14:23:30

encryption seems to be f(x) = x^2 mod p
the output of the example is Sun Jun 13 16:20:39 2004, which lets x be 1087136439, but then f(x) would be 2933335865 and not 1749870067 as indicated by the input!


Added by:adrian
Date:2004-05-13
Time limit:1s
Source limit:10000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS PERL6 VB.NET
Resource:;)