OFFSET
0,1
LINKS
Harry J. Smith, Table of n, a(n) for n=0..500
EXAMPLE
Since 3 is odd, the next term is 7 * 3 - 1 = 20.
And since 20 is even, the next term is 20/2 = 10.
MATHEMATICA
NestList[If[OddQ[#], 7# - 1, #/2] &, 3, 50] (* Harvey P. Dale, Aug 04 2011 *)
PROG
(PARI) { for (n=0, 50, if (n, if(a%2, a=7*a - 1, a/=2), a=3); print1(a, ", ") ) } \\ Harry J. Smith, Sep 01 2009
(Python)
def iter(n): return 7*n-1 if n%2 == 1 else n//2
def aupton(terms):
alst = [3]
for n in range(1, terms+1): alst.append(iter(alst[-1]))
return alst
print(aupton(42)) # Michael S. Branicky, Mar 20 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jason Earls, Aug 27 2001
EXTENSIONS
More terms from Larry Reeves (larryr(AT)acm.org), Aug 29 2001
Title edited by Michael S. Branicky, Mar 20 2021
STATUS
approved