cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A239713 Primes of the form m = 3^i + 3^j - 1, where i > j >= 0.

Original entry on oeis.org

3, 11, 29, 83, 89, 107, 251, 269, 809, 971, 2213, 2267, 6563, 6569, 6803, 8747, 19709, 19763, 20411, 59051, 65609, 177173, 183707, 531521, 538001, 590489, 1594331, 1594403, 1595051, 1596509, 4782971, 4782977, 4783697, 14348909, 14349149, 14526053, 14880347
Offset: 1

Views

Author

Hieronymus Fischer, Mar 28 2014

Keywords

Comments

The base-3 representation of a term 3^i + 3^j - 1 has base-3 digital sum = 1 + 2*j == 1 (mod 2).
In base-3 representation the first terms are 10, 102, 1002, 10002, 10022, 10222, 100022, 100222, 1002222, 1022222, 10000222, 10002222, 100000002, 100000022, 100022222, 102222222, 1000000222, 1000002222, 1000222222, 10000000002, 10022222222, 100000000222, 100022222222, ...

Examples

			a(1) = 3, since 3 = 3^1 + 3^0 - 1 is prime.
a(5) = 89, since 89 = 3^4 + 3^2 - 1 is prime.
		

Crossrefs

Cf. A018900, A239709, A239712 (base 2), A239714 (base 4), A239715 (base 5), A239716 (base 6), A239717 (base 7), A239718 (base 8), A239719 (base 9), A239720 (base 10).

Programs

  • Maple
    select(isprime, [seq(seq(3^i+3^j-1, j=0..i-1), i=1..25)])[];  # Alois P. Heinz, Dec 22 2024
  • Mathematica
    Select[Flatten[Table[3^i + 3^j - 1, {i, 1, 25}, {j, 0, i - 1}]], PrimeQ] (* Jean-François Alcover, Mar 17 2025, after Alois P. Heinz *)
  • Smalltalk
    A239713
    "Answers the n-th term of A239713.
      Usage: n A239713
      Answer: a(n)"
      | a b i j k p q terms |
      terms := OrderedCollection new.
      k := 0.
      b := 3.
      p := b.
      i := 1.
      [k < self] whileTrue:
             [j := 0.
             q := 1.
             [j < i and: [k < self]] whileTrue:
                       [a := p + q - 1.
                       a isPrime
                            ifTrue:
                                [k := k + 1.
                                terms add: a].
                       q := b * q.
                       j := j + 1].
             i := i + 1.
             p := b * p].
         ^terms at: self
    [by Hieronymus Fischer, Apr 14 2014]
    --------------------
    
  • Smalltalk
    A239713
    "Version 2: Answers the n-th term of A239713.
      Uses distinctPowersOf: b from A018900
      Usage: n A239713
      Answer: a(n)”
      | a k n terms |
      terms := OrderedCollection new.
      n := 1.
      k := 0.
      [k < self] whileTrue:
             [(a:= (n distinctPowersOf: 3) - 1)
                  isPrime ifTrue:    [k := k + 1.
                                     terms add: a].
                  n := n + 1].
      ^terms at: self
    [by Hieronymus Fischer, Apr 22 2014]
    -----------
    
  • Smalltalk
    A239713
      "Version 3: Answer an array of the first n terms of A239713.
      Uses method primesWhichAreDistinctPowersOf: b withOffset: d from A239712.
      Usage: n A239713
      Answer: #(3 11 29 ... ) [a(1) ... a(n)]”
      ^self primesWhichAreDistinctPowersOf: 3 withOffset: -1
    [by Hieronymus Fischer, Apr 22 2014]