4
$\begingroup$

I have a sequence 1, 2, 3, 4, 6, 9, 13, 19, 28 ...., for which a general formula would be $a(n) = 2^{(n+1)//2 + 1} -1 - (n\pmod2)$.

(where // stands for integer divison)

Similarly, how do I derive a formula for $a(n)$ of the sequence of "Primes whose digits are prime":

2, 3, 5, 7, 23, 37, 53, 73, 223, ...

https://oeis.org/search?q=2%2C3%2C5%2C7%2C23%2C&language=english&go=Search

I'm not really good at mathematics (high school level), so kindly explain it in the simplest way possible.

  • 1
    Correct your formula, it gives powers of $2$2017-02-23
  • 0
    @Leox, thanks. I've corrected it.2017-02-24

2 Answers 2

1

The unfortunate answer is that this interesting sequence does not have a formula.

The OP found the sequence in the Online Encyclopedia of Integer Sequences at

https://oeis.org/search?q=2%2C3%2C5%2C7%2C23%2C&language=english&go=Search

References there describe it - with no formula.

  • 1
    Please visit https://oeis.org/search?q=2%2C3%2C5%2C7%2C23%2C&language=english&go=Search. [A019546]2017-02-23
  • 0
    @Amal.R Good looking. I've edited accordingly. Welcome to stackexchange..2017-02-23
2

It is quite difficult enough to come up with a formula for primes. When on top of that you want a formula that gives prime numbers satisfying some requirement to a specific base (decimal, in this case), the task might as well be impossible (and probably is).

Consider the formula $n^2 + n + 41$. Compute it for $0 \leq n < 41$. You'll get forty primes. Or just go up to $n = 5$ or $6$ and look it up in the OEIS. This gives primes in order, but it obviously doesn't give all primes.

Here is another favorite of mine from the OEIS: $$\frac{n^5}{6} - \frac{19n^4}{8} + \frac{51n^3}{4} - \frac{253n^2}{8} + \frac{445n}{12} - 14.$$ This gives the first five primes in order... and then it continues $42, 168, 520, \ldots$

Now, if you wanted a formula that gives only numbers with prime digits in base $10$, but without demanding that each resulting number be prime, that's probably doable: $2, 3, 5, 7, 22, 23, 25, 27, 32, 33, 35, 37, 52, \ldots$ In fact, the OEIS does gives a few formulas, some ugly but valid.

Do notice that the OEIS often gives you programming snippets that you can use to make your computer or some other computer calculate the sequence for you.

In the case of primes with prime digits only, the OEIS gives us the Mathematica snippet Select[Prime[Range[700]], Complement[IntegerDigits[#], {2, 3, 5, 7}] == {} &] which you can put into Wolfram Alpha and make their computer give you the sequence up to some threshold. But what it does is pull up a list of primes and look at them one by one to determine whether to keep it in the list or strike it out.