login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A147991 Sequence S such that 1 is in S and if x is in S, then 3x-1 and 3x+1 are in S. 10
1, 2, 4, 5, 7, 11, 13, 14, 16, 20, 22, 32, 34, 38, 40, 41, 43, 47, 49, 59, 61, 65, 67, 95, 97, 101, 103, 113, 115, 119, 121, 122, 124, 128, 130, 140, 142, 146, 148, 176, 178, 182, 184, 194, 196, 200, 202, 284, 286, 290, 292, 302, 304, 308, 310, 338, 340, 344, 346 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

Positive numbers that can be written in balanced ternary without a 0 trit. - J. Hufford, Jun 30 2015

LINKS

Robert Israel, Table of n, a(n) for n = 1..10000

Gevorg Hmayakyan, Trig identity for a(n)

FORMULA

a(n) = 3*a(n/2) - 1 if n>=2 is even, 3*a((n-1)/2) + 1 if n is odd, a(0)=0. - Robert Israel, May 05 2014

G.f. g(x) satisfies g(x) = 3*(x+1)*g(x^2) + x/(1+x). - Robert Israel, May 05 2014

Product_{j=0..n-1} cos(3^j) = 2^(-n+1)*Sum_{i=2^(n-1)..2^n-1} cos(a(i)). - Gevorg Hmayakyan, Jan 15 2017

Sum_{i=2^(n-1)..2^n-1} cos(a(i)/3^(n-1)*Pi/2) = 0. - Gevorg Hmayakyan, Jan 15 2017

a(n) = -a(-1-n) for all n in Z. - Michael Somos, Dec 22 2018

EXAMPLE

0th generation: 1;

1st generation: 2 4;

2nd generation: 5 7 11 13.

MAPLE

A147991:= proc(n) option remember; if n::even then 3*procname(n/2)-1 else 3*procname((n-1)/2)+1 fi end proc:

A147991(1):= 1:

[seq](A147991(i), i=1..1000); # Robert Israel, May 05 2014

MATHEMATICA

nn=346; s={1}; While[s1=Select[Union[s, 3*s-1, 3*s+1], # <= nn &];  s != s1, s=s1]; s

a[ n_] := If[ n < -1 || n > 0, 3 a[Quotient[n, 2]] - (-1)^Mod[n, 2], 0]; (* Michael Somos, Dec 22 2018 *)

PROG

(Haskell)

import Data.Set (singleton, insert, deleteFindMin)

a147991 n = a147991_list !! (n-1)

a147991_list = f $ singleton 1 where

   f s = m : (f $ insert (3*m - 1) $ insert (3*m + 1) s')

         where (m, s') = deleteFindMin s

-- Reinhard Zumkeller, Feb 21 2012, Jan 23 2011

(PARI) {a(n) = if( n<-1 || n>0, 3*a(n\2) - (-1)^(n%2), 0)}; /* Michael Somos, Dec 22 2018 */

CROSSREFS

Cf. A168542.

Sequence in context: A108464 A128815 A056527 * A033160 A110924 A192590

Adjacent sequences:  A147988 A147989 A147990 * A147992 A147993 A147994

KEYWORD

nonn

AUTHOR

Clark Kimberling, Dec 07 2008

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified October 14 12:19 EDT 2019. Contains 328006 sequences. (Running on oeis4.)