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.

A239708 Numbers of the form m = 2^i + 2^j, where i > j >= 0, such that m - 1 is prime.

Original entry on oeis.org

3, 6, 12, 18, 20, 24, 48, 68, 72, 80, 132, 192, 258, 264, 272, 384, 1032, 1040, 1088, 1152, 1280, 2064, 2112, 4100, 4112, 4128, 4160, 5120, 6144, 8448, 16448, 20480, 32772, 32784, 32832, 33024, 33792, 65538, 65540, 65544, 65552, 65600, 66048, 73728, 81920, 262148, 262152, 262272, 262400, 263168, 266240, 294912, 524352, 528384, 786432
Offset: 1

Views

Author

Hieronymus Fischer, Mar 27 2014

Keywords

Comments

Complement of the disjunction of A079696 with A187813. This means that a number m is a term if and only if b = 2 is the only base for which the base-b digital sum of m is b.

Examples

			a(1) = 3, since 3 = 2^1 + 2^0.
a(3) = 12, since 12 = 2^3 + 2^2.
		

Crossrefs

Programs

  • Python
    from itertools import islice
    from sympy import isprime
    def A239708_gen(): # generator of terms
        yield (n:=3)
        while True:
            n = n^((a:=-n&n+1)|(a>>1)) if n&1 else ((n&~(b:=n+(a:=n&-n)))>>a.bit_length())^b
            if isprime(n-1):
                yield n
    A239708_list = list(islice(A239708_gen(),30)) # Chai Wah Wu, Mar 24 2025
  • Smalltalk
    A239708
    "Answers the n-th term of A239708.
      Usage: n A239708
      Answer: a(n)"
      | a b i k m p q terms |
      terms := OrderedCollection new.
      b := 2.
      p := 1.
      k := 0.
      m := 0.
      [k < self] whileTrue:
             [m := m + 1.
             p := b * p.
             q := 1.
             i := 0.
             [i < m and: [k < self]] whileTrue:
                       [i := i + 1.
                       a := p + q.
                       (a - 1) isPrime
                            ifTrue:
                                [k := k + 1.
                                terms add: a].
                       q := b * q]].
      ^terms at: self
    -----------------
    
  • Smalltalk
    A239708inv
      "Answers a kind of inverse of A239708.
      Usage: n A239708inv
      Answer: max ( k | A239708(k) < n)"
      | k |
      k := 1.
      [k A239708 < self] whileTrue: [k := k + 1].
      ^k - 1
    

Formula

A239703(a(n)) = 1.