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.
%I A239713 #25 Mar 17 2025 07:02:12 %S A239713 3,11,29,83,89,107,251,269,809,971,2213,2267,6563,6569,6803,8747, %T A239713 19709,19763,20411,59051,65609,177173,183707,531521,538001,590489, %U A239713 1594331,1594403,1595051,1596509,4782971,4782977,4783697,14348909,14349149,14526053,14880347 %N A239713 Primes of the form m = 3^i + 3^j - 1, where i > j >= 0. %C A239713 The base-3 representation of a term 3^i + 3^j - 1 has base-3 digital sum = 1 + 2*j == 1 (mod 2). %C A239713 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, ... %H A239713 Hieronymus Fischer, <a href="/A239713/b239713.txt">Table of n, a(n) for n = 1..131</a> [a(123) corrected by _Georg Fischer_, Dec 22 2024] %e A239713 a(1) = 3, since 3 = 3^1 + 3^0 - 1 is prime. %e A239713 a(5) = 89, since 89 = 3^4 + 3^2 - 1 is prime. %p A239713 select(isprime, [seq(seq(3^i+3^j-1, j=0..i-1), i=1..25)])[]; # _Alois P. Heinz_, Dec 22 2024 %t A239713 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_ *) %o A239713 (Smalltalk) %o A239713 A239713 %o A239713 "Answers the n-th term of A239713. %o A239713 Usage: n A239713 %o A239713 Answer: a(n)" %o A239713 | a b i j k p q terms | %o A239713 terms := OrderedCollection new. %o A239713 k := 0. %o A239713 b := 3. %o A239713 p := b. %o A239713 i := 1. %o A239713 [k < self] whileTrue: %o A239713 [j := 0. %o A239713 q := 1. %o A239713 [j < i and: [k < self]] whileTrue: %o A239713 [a := p + q - 1. %o A239713 a isPrime %o A239713 ifTrue: %o A239713 [k := k + 1. %o A239713 terms add: a]. %o A239713 q := b * q. %o A239713 j := j + 1]. %o A239713 i := i + 1. %o A239713 p := b * p]. %o A239713 ^terms at: self %o A239713 [by _Hieronymus Fischer_, Apr 14 2014] %o A239713 -------------------- %o A239713 (Smalltalk) %o A239713 A239713 %o A239713 "Version 2: Answers the n-th term of A239713. %o A239713 Uses distinctPowersOf: b from A018900 %o A239713 Usage: n A239713 %o A239713 Answer: a(n)” %o A239713 | a k n terms | %o A239713 terms := OrderedCollection new. %o A239713 n := 1. %o A239713 k := 0. %o A239713 [k < self] whileTrue: %o A239713 [(a:= (n distinctPowersOf: 3) - 1) %o A239713 isPrime ifTrue: [k := k + 1. %o A239713 terms add: a]. %o A239713 n := n + 1]. %o A239713 ^terms at: self %o A239713 [by _Hieronymus Fischer_, Apr 22 2014] %o A239713 ----------- %o A239713 (Smalltalk) %o A239713 A239713 %o A239713 "Version 3: Answer an array of the first n terms of A239713. %o A239713 Uses method primesWhichAreDistinctPowersOf: b withOffset: d from A239712. %o A239713 Usage: n A239713 %o A239713 Answer: #(3 11 29 ... ) [a(1) ... a(n)]” %o A239713 ^self primesWhichAreDistinctPowersOf: 3 withOffset: -1 %o A239713 [by _Hieronymus Fischer_, Apr 22 2014] %Y A239713 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). %K A239713 nonn %O A239713 1,1 %A A239713 _Hieronymus Fischer_, Mar 28 2014