# Prime of my Life

This year my age is a prime number, and so is this year. This conjunction will repeat in 10 years and again in 12. If I live to 100, I will lived exactly 11 years in which my age and the year are both prime. My condolences to those of you born in odd-numbered years, who will experience this phenomenon at most once if at all.

As it turns out, if I tell you that the consecutive gaps between years in which my age and the year were, are, or will be both primes are 4, 2, 4, 14, 10, 2, 10, 14, 16, and 14, then that is enough information for you to tell me exactly which year I was born.

# The Challenge

This challenge is to write a program or function that, given a list of even numbers, each representing gaps between consecutive prime-age prime-year conjunctions, print or return all years between 1AD and 2100AD inclusive such that a person born in that year (and living no longer than 100 years) would have exactly that sequence of gaps between prime-year prime-age conjuctions (i.e. no other such conjunctions)

Or, in more mathematical terms, given a list $$\a\$$, print or return all $$\x\$$ between 1 and 2100 such that there exists a $$\0 such that $$\x+b\$$ is prime, $$\b\$$ is prime, and $$\x+b+\sum^n_{i=1}a_i\$$ and $$\b+\sum^n_{i=1}a_i\$$ are both prime for all $$\n\$$ up to the length of $$\a\$$ (where the latter sum is guaranteed to be less than 100).

If there are no such years in that range, you may print or return anything falsy or nothing at all.

I/O is flexible: just be able to take a list of numbers as input and produce a list of numbers as output.

# Examples

[4,2,4,14,10,2,10,14,16,14]          =>     [1986]
(6,4,2,4)                            =>     ()
6,4,2,4,8,6,10,12,14,10,6            =>     1980
4;4                                  =>     (No output)
[]...................................=>     (A list containing every odd number between 1 and 2099, plus the numbers 1136, 1732, and 1762)


# Scoring

Shortest program, in bytes, wins.

Bonus: I will create a bounty to reward the shortest answer that produces the correct output using an algorithm which has an asymptotic worst case running time strictly better than $$\O(YA+A^2)\$$ where Y is the maximum birth year and A is the maximum age. (Y and A are not inputs to your program or function, but pretend they are for the purposes of determining if your algorithm qualifies.) If you wish to compete in the bonus challenge, it is up to you to convince me your program or function meets the requirements. You may assume that all built-ins use the asymptotically fastest known classical algorithm to achieve their results (e.g. generates primes with a Sieve of Atkin rather than a Sieve of Eratosthenes). Yes, it is possible to receive this bounty even if you win the regular challenge.

• I was born in an odd numbered year, and have a prime age right now. Its not only for people born in even numbered years ;) May 31, 2017 at 15:35
• Yeah - I was born in a prime year and am currently a prime age. Maybe consider changing it to "will turn a prime age". May 31, 2017 at 15:36
• What’s special about the numbers 1136, 1732, and 1762? May 31, 2017 at 15:45
• O(YA+A^2) is the same as O(1), since Y and A are both constants (respectively 2100 and 100, according to the challenge definition). Should answers to the “bonus challenge” take Y and A as input? May 31, 2017 at 15:49
• Since the input is described as "would have exactly that sequence of gaps", then the output for the empty input should not include odd years two less than a prime. May 31, 2017 at 15:55

# 05AB1E, 18 bytes

2101GтLDpÏN+DpÏ¥Q–


Try it online!

Explanation

2101G               # for each N in [1 ... 2100]
тL             # push the range [1 ... 100]
DpÏ          # keep only numbers that are prime
N+        # add N to each
DpÏ     # keep only numbers that are prime
¥    # calculate delta's
Q–  # print N if the resulting list is equal to input


# Jelly, 19 bytes

97ÆR+⁸ÆPÐfI⁼
⁽¥cçÐf


Try it online!

### How it works

⁽¥cçÐf        Main link. Argument: A (array of integers)

⁽¥c           Yield 2100.
çÐf        Apply the helper link to each n in [1, ..., 2100], with right
argument A. Yield all values of n that return 1.

97ÆR+⁸ÆPÐfI⁼  Helper link. Left argument: n. Right argument: A

97ÆR          Prime range; yield all prime numbers in [1, ..., 97].
+⁸        Add n to each of these primes.
ÆPDf    Filter by primality, keeping only prime sums.
I   Increments; compute all forward differences.
⁼  Return 1 if the result and A are equal, 0 if not.


# Pyth, 24 bytes

fq.+f&P_+TYP_YU100QU2100


Try it online!

I feel like this can be golfed down quite a bit, but here it is for now.