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.

This page as a plain text file.
%I A239708 #22 Mar 24 2025 10:22:31
%S A239708 3,6,12,18,20,24,48,68,72,80,132,192,258,264,272,384,1032,1040,1088,
%T A239708 1152,1280,2064,2112,4100,4112,4128,4160,5120,6144,8448,16448,20480,
%U A239708 32772,32784,32832,33024,33792,65538,65540,65544,65552,65600,66048,73728,81920,262148,262152,262272,262400,263168,266240,294912,524352,528384,786432
%N A239708 Numbers of the form m = 2^i + 2^j, where i > j >= 0, such that m - 1 is prime.
%C A239708 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.
%H A239708 Hieronymus Fischer, <a href="/A239708/b239708.txt">Table of n, a(n) for n = 1..250</a>
%F A239708 A239703(a(n)) = 1.
%e A239708 a(1) = 3, since 3 = 2^1 + 2^0.
%e A239708 a(3) = 12, since 12 = 2^3 + 2^2.
%o A239708 (Smalltalk)
%o A239708 A239708
%o A239708 "Answers the n-th term of A239708.
%o A239708   Usage: n A239708
%o A239708   Answer: a(n)"
%o A239708   | a b i k m p q terms |
%o A239708   terms := OrderedCollection new.
%o A239708   b := 2.
%o A239708   p := 1.
%o A239708   k := 0.
%o A239708   m := 0.
%o A239708   [k < self] whileTrue:
%o A239708          [m := m + 1.
%o A239708          p := b * p.
%o A239708          q := 1.
%o A239708          i := 0.
%o A239708          [i < m and: [k < self]] whileTrue:
%o A239708                    [i := i + 1.
%o A239708                    a := p + q.
%o A239708                    (a - 1) isPrime
%o A239708                         ifTrue:
%o A239708                             [k := k + 1.
%o A239708                             terms add: a].
%o A239708                    q := b * q]].
%o A239708   ^terms at: self
%o A239708 -----------------
%o A239708 (Smalltalk)
%o A239708 A239708inv
%o A239708   "Answers a kind of inverse of A239708.
%o A239708   Usage: n A239708inv
%o A239708   Answer: max ( k | A239708(k) < n)"
%o A239708   | k |
%o A239708   k := 1.
%o A239708   [k A239708 < self] whileTrue: [k := k + 1].
%o A239708   ^k - 1
%o A239708 (Python)
%o A239708 from itertools import islice
%o A239708 from sympy import isprime
%o A239708 def A239708_gen(): # generator of terms
%o A239708     yield (n:=3)
%o A239708     while True:
%o A239708         n = n^((a:=-n&n+1)|(a>>1)) if n&1 else ((n&~(b:=n+(a:=n&-n)))>>a.bit_length())^b
%o A239708         if isprime(n-1):
%o A239708             yield n
%o A239708 A239708_list = list(islice(A239708_gen(),30)) # _Chai Wah Wu_, Mar 24 2025
%Y A239708 Cf. A239709 - A239720.
%Y A239708 Cf. A239703, A187813, A079696, A008864.
%K A239708 nonn
%O A239708 1,1
%A A239708 _Hieronymus Fischer_, Mar 27 2014