login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A239713 Primes of the form m = 3^i + 3^j - 1, where i > j >= 0. 2
3, 11, 29, 83, 89, 107, 251, 269, 809, 971, 2213, 2267, 6563, 6569, 6803, 8747, 19709, 19763, 20411, 59051, 65609, 177173, 183707, 531521, 538001, 590489, 1594331, 1594403, 1595051, 1596509, 4782971, 4782977, 4783697, 14348909, 14349149, 14526053, 14880347 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
The base-3 representation of a term 3^i + 3^j - 1 has base-3 digital sum = 1 + 2*j == 1 (mod 2).
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, ...
LINKS
EXAMPLE
a(1) = 3, since 3 = 3^1 + 3^0 - 1 is prime.
a(5) = 89, since 89 = 3^4 + 3^2 - 1 is prime.
PROG
(Smalltalk)
"Answers the n-th term of A239713.
Usage: n A239713
Answer: a(n)"
| a b i j k p q terms |
terms := OrderedCollection new.
k := 0.
b := 3.
p := b.
i := 1.
[k < self] whileTrue:
[j := 0.
q := 1.
[j < i and: [k < self]] whileTrue:
[a := p + q - 1.
a isPrime
ifTrue:
[k := k + 1.
terms add: a].
q := b * q.
j := j + 1].
i := i + 1.
p := b * p].
^terms at: self
[by Hieronymus Fischer, Apr 14 2014]
--------------------
(Smalltalk)
"Version 2: Answers the n-th term of A239713.
Uses distinctPowersOf: b from A018900
Usage: n A239713
Answer: a(n)”
| a k n terms |
terms := OrderedCollection new.
n := 1.
k := 0.
[k < self] whileTrue:
[(a:= (n distinctPowersOf: 3) - 1)
isPrime ifTrue: [k := k + 1.
terms add: a].
n := n + 1].
^terms at: self
[by Hieronymus Fischer, Apr 22 2014]
-----------
(Smalltalk)
"Version 3: Answer an array of the first n terms of A239713.
Uses method primesWhichAreDistinctPowersOf: b withOffset: d from A239712.
Usage: n A239713
Answer: #(3 11 29 ... ) [a(1) ... a(n)]”
^self primesWhichAreDistinctPowersOf: 3 withOffset: -1
[by Hieronymus Fischer, Apr 22 2014]
CROSSREFS
Sequence in context: A110954 A000251 A159229 * A122023 A259594 A293010
KEYWORD
nonn
AUTHOR
Hieronymus Fischer, Mar 28 2014
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 6 05:18 EDT 2024. Contains 372290 sequences. (Running on oeis4.)