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.

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

This page as a plain text file.
%I A239712 #28 May 14 2017 12:02:07
%S A239712 2,5,11,17,19,23,47,67,71,79,131,191,257,263,271,383,1031,1039,1087,
%T A239712 1151,1279,2063,2111,4099,4111,4127,4159,5119,6143,8447,16447,20479,
%U A239712 32771,32783,32831,33023,33791,65537,65539,65543,65551,65599,66047,73727,81919,262147,262151,262271,262399,263167
%N A239712 Primes of the form m = 2^i + 2^j - 1, where i > j >= 0.
%C A239712 Numbers m such that b = 2 is the only base such that the base-b digital sum of m + 1 is equal to b.
%C A239712 Example: 5 + 1 = 110_2 which implies ds_2(5 + 1) = 2 = b, where ds_b = digital sum in base-b. However, ds_3(6) = 2 <> 3, ds_4(6) = 3 <> 4, ds_5(6) = 2 <> 5, ds_6(6) = 1 <> 6. For all other bases > 6 we have ds_b(6) = 6 <> b. It follows that b = 2 is the only such base.
%C A239712 The base-2 representation of a term 2^i + 2^j - 1 has a base-2 digital sum of 1 + j.
%C A239712 In base-2 representation the first terms are 10, 101, 1011, 10001, 10011, 10111, 101111, 1000011, 1000111, 1001111, 10000011, 10111111, 100000001, 100000111, 100001111, 101111111, 10000000111, 10000001111, 10000111111, 10001111111, ...
%C A239712 Numbers m = 2^i + 2^j - 1 with odd i and j are not terms. Example: 10239 = 2^13 + 2^11 - 1 is not a prime.
%H A239712 Hieronymus Fischer, <a href="/A239712/b239712.txt">Table of n, a(n) for n = 1..250</a>
%F A239712 a(n) = A239708(n) - 1.
%F A239712 a(n+1) = min(A018900(k) > a(n)| A018900(k) - 1 is prime,  k >= 1) - 1.
%e A239712 a(1) = 2, since 2 = 2^1 + 2^0 - 1 is prime.
%e A239712 a(5) = 19, since 19 = 2^4 + 2^2 - 1 is prime.
%t A239712 Select[Union[Total/@(2^#&/@Subsets[Range[0,20],{2}])-1],PrimeQ] (* _Harvey P. Dale_, Aug 08 2014 *)
%o A239712 (Smalltalk)
%o A239712 A239712
%o A239712 "Answers the n-th term of A239712.
%o A239712   Usage: n A239712
%o A239712   Answer: a(n)"
%o A239712   | a b i k m p q terms |
%o A239712   terms := OrderedCollection new.
%o A239712   b := 2.
%o A239712   p := 1.
%o A239712   k := 0.
%o A239712   m := 0.
%o A239712   [k < self] whileTrue:
%o A239712          [m := m + 1.
%o A239712          p := b * p.
%o A239712          q := 1.
%o A239712          i := 0.
%o A239712          [i < m and: [k < self]] whileTrue:
%o A239712                    [i := i + 1.
%o A239712                    a := p + q - 1.
%o A239712                    a isPrime
%o A239712                         ifTrue:
%o A239712                             [k := k + 1.
%o A239712                             terms add: a].
%o A239712                    q := b * q]].
%o A239712   ^terms at: self
%o A239712 [by _Hieronymus Fischer_, Apr 22 2014]
%o A239712 -----------
%o A239712 (Smalltalk)
%o A239712 floorPrimesWhichAreDistinctPowersOf: b withOffset: d
%o A239712   "Answers an array which holds the primes < n that obey b^i + b^j + d, i>j>=0,
%o A239712   where n is the receiver. b > 1 (here: b = 2, d = -1).
%o A239712   Uses floorDistinctPowersOf: from A018900
%o A239712   Usage:
%o A239712   n floorPrimesWhichAreDistinctPowersOf: b withOffset: d
%o A239712   Answer: #(2 5 11 17 19 23 ...) [terms < n]"
%o A239712   ^((self - d floorDistinctPowersOf: b)
%o A239712   collect: [:i | i + d]) select: [:i | i isPrime]
%o A239712 [by _Hieronymus Fischer_, Apr 22 2014]
%o A239712 ------------
%o A239712 (Smalltalk)
%o A239712 primesWhichAreDistinctPowersOf: b withOffset: d
%o A239712   "Answers an array which holds the n primes of the form b^i + b^j + d, i>j>=0, where n is the receiver.
%o A239712   Direct calculation by scanning b^i + b^j + d in increasing order and selecting terms which are prime.
%o A239712   b > 1; this sequence: b = 2, d = 1.
%o A239712   Usage:
%o A239712   n primesWhichAreDistinctPowersOf: b withOffset: d
%o A239712   Answer: #(2 5 11 17 19 23 ...) [a(1) ... a(n)]"
%o A239712   | a k p q terms n |
%o A239712   terms := OrderedCollection new.
%o A239712   n := self.
%o A239712   k := 0.
%o A239712   p := b.
%o A239712   [k < n] whileTrue:
%o A239712          [q := 1.
%o A239712          [q < p and: [k < n]] whileTrue:
%o A239712                    [a := p + q + d.
%o A239712                    a isPrime
%o A239712                         ifTrue:
%o A239712                             [k := k + 1.
%o A239712                             terms add: a].
%o A239712                    q := b * q].
%o A239712          p := b * p].
%o A239712   ^terms asArray
%o A239712 [by _Hieronymus Fischer_, Apr 22 2014]
%Y A239712 Cf. A007953, A018900, A081091, A008864, A187813.
%Y A239712 Cf. A239703, A239708, A239709, A239713 - A239720.
%K A239712 nonn
%O A239712 1,1
%A A239712 _Hieronymus Fischer_, Mar 28 2014 and Apr 22 2014
%E A239712 Examples moved from Maple field to Examples field by _Harvey P. Dale_, Aug 08 2014