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

%I #18 Nov 02 2014 12:18:37

%S 3,6,12,18,20,24,48,68,72,80,132,192,258,264,272,384,1032,1040,1088,

%T 1152,1280,2064,2112,4100,4112,4128,4160,5120,6144,8448,16448,20480,

%U 32772,32784,32832,33024,33792,65538,65540,65544,65552,65600,66048,73728,81920,262148,262152,262272,262400,263168,266240,294912,524352,528384,786432

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

%C 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 Hieronymus Fischer, <a href="/A239708/b239708.txt">Table of n, a(n) for n = 1..250</a>

%F A239703(a(n)) = 1.

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

%e a(3) = 12, since 12 = 2^3 + 2^2.

%o (Smalltalk)

%o A239708

%o "Answers the n-th term of A239708.

%o Usage: n A239708

%o Answer: a(n)"

%o | a b i k m p q terms |

%o terms := OrderedCollection new.

%o b := 2.

%o p := 1.

%o k := 0.

%o m := 0.

%o [k < self] whileTrue:

%o [m := m + 1.

%o p := b * p.

%o q := 1.

%o i := 0.

%o [i < m and: [k < self]] whileTrue:

%o [i := i + 1.

%o a := p + q.

%o (a - 1) isPrime

%o ifTrue:

%o [k := k + 1.

%o terms add: a].

%o q := b * q]].

%o ^terms at: self

%o -----------------

%o (Smalltalk)

%o A239708inv

%o "Answers a kind of inverse of A239708.

%o Usage: n A239708inv

%o Answer: max ( k | A239708(k) < n)"

%o | k |

%o k := 1.

%o [k A239708 < self] whileTrue: [k := k + 1].

%o ^k - 1

%Y Cf. A239709 - A239720.

%Y Cf. A239703, A187813, A079696, A008864.

%K nonn

%O 1,1

%A _Hieronymus Fischer_, Mar 27 2014