A309523 Start with a(1) = 1 and apply certain patterns of operations on a(n-1) to obtain a(n) as described in comments.
1, 7, 8, 2, 16, 4, 5, 17, 10, 34, 35, 11, 70, 22, 23, 71, 46, 142, 143, 47, 286, 94, 95, 287, 190, 574, 575, 191, 1150, 382, 383, 1151, 766, 2302, 2303, 767, 4606, 1534, 1535, 4607, 3070, 9214, 9215, 3071, 18430, 6142, 6143, 18431, 12286, 36862
Offset: 1
Examples
A308709 | this sequence | 1 | 7 +1 *3 +1 | 8 +1 | 2 +1 /3 -1 3 | 16 +1 *3 *2 -2 1 /3 | 4 -1 /3 -1 | 5 +1 | 17 +1 *3 -1 2 *2 | 10 +1 /3 *2 -2 6 *3 | 34 +1 *3 +1 | 35 +1 | 11 +1 /3 -1 12 *2 | 70 +1 *3 *2 -2 4 /3 | 22 -1 /3 -1 | 23 +1 | 71 +1 *3 -1 8 *2 | 46 +1 /3 *2 -2 24 *3 | 142 +1 *3 +1 | 143 +1
Links
- Colin Barker, Table of n, a(n) for n = 1..1000
- Index entries for linear recurrences with constant coefficients, signature (1,-1,1,0,0,0,0,4,-4,4,-4).
Crossrefs
Cf. A308709.
Programs
-
Mathematica
LinearRecurrence[{1, -1, 1, 0, 0, 0, 0, 4, -4, 4, -4},{1, 7, 8, 2, 16, 4, 5, 17, 10, 34, 35}, 50]
-
PARI
Vec(x*(1 + 6*x + 2*x^2 + 15*x^4 - 18*x^5 + 15*x^6 - 10*x^8 + 12*x^9 - 14*x^10) / ((1 - x)*(1 + x^2)*(1 - 2*x^4)*(1 + 2*x^4)) + O(x^40)) \\ Colin Barker, Aug 06 2019
-
Perl
use integer; my @a; my $n = 1; $a[$n ++] = 1; $a[$n ++] = (($a[$n-1] +1) *3) +1; # 7 while ($n < 50) { $a[$n ++] = (($a[$n-1] +1) ); # 8 $a[$n ++] = (($a[$n-1] +1) /3) -1; # 2 $a[$n ++] = (($a[$n-1] +1) *3) *2 -2; # 16 $a[$n ++] = (($a[$n-1] -1) /3) -1; # 4 $a[$n ++] = (($a[$n-1] +1) ); # 5 $a[$n ++] = (($a[$n-1] +1) *3) -1; # 17 $a[$n ++] = (($a[$n-1] +1) /3) *2 -2; # 10 $a[$n ++] = (($a[$n-1] +1) *3) +1; # 34 } # while shift(@a); # remove $a[0] print join(", ", @a) . "\n"; # Georg Fischer, Aug 07 2019
-
Python
def A309523(): k, j, a = 0, 0, 1 def b(a): return a + 1 def c(a): return a + 2 def d(a): return a - 1 def e(a): return a - 2 def f(a): return a << 1 def g(a): return a * 3 def h(a): return a // 3 O = [c,g,e,b,b,h,d,b,g,f,e,c,h,e,b,b,g,d,b,h,f,e] L = [3,1,3,4] while True: yield(a) for _ in range(L[j]): a = O[k](a) k += 1; k %= 22 j += 1; j %= 4 a = A309523() print([next(a) for in range(50)]) # _Peter Luschny, Aug 06 2019
Formula
From Colin Barker, Aug 06 2019: (Start)
G.f.: x*(1 + 6*x + 2*x^2 + 15*x^4 - 18*x^5 + 15*x^6 - 10*x^8 + 12*x^9 - 14*x^10) / ((1 - x)*(1 + x^2)*(1 - 2*x^4)*(1 + 2*x^4)).
a(n) = a(n-1) - a(n-2) + a(n-3) + 4*a(n-8) - 4*a(n-9) + 4*a(n-10) - 4*a(n-11) for n>11.
(End)
Comments