cp's OEIS Frontend

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.

Showing 1-4 of 4 results.

A008344 a(1)=0; thereafter a(n+1) = a(n) - n if a(n) >= n otherwise a(n+1) = a(n) + n.

Original entry on oeis.org

0, 1, 3, 0, 4, 9, 3, 10, 2, 11, 1, 12, 0, 13, 27, 12, 28, 11, 29, 10, 30, 9, 31, 8, 32, 7, 33, 6, 34, 5, 35, 4, 36, 3, 37, 2, 38, 1, 39, 0, 40, 81, 39, 82, 38, 83, 37, 84, 36, 85, 35, 86, 34, 87, 33, 88, 32, 89, 31, 90, 30, 91, 29, 92, 28, 93, 27, 94, 26, 95, 25, 96, 24, 97, 23, 98
Offset: 1

Views

Author

Keywords

Comments

p^a(n) = A084110(p^(n-1)) for n>1 and p prime. - Reinhard Zumkeller, May 12 2003
For n > 1: a(A029858(n)) = A029858(n) and a(A003462(n)) = 0. - Reinhard Zumkeller, May 09 2012
Absolute first differences of A085059; abs(a(n+1)-a(n)) = n, see also A086283. - Reinhard Zumkeller, Oct 17 2014
For n>3, when a(n) = 3, a(n+1) is in A116970. - Bill McEachen, Oct 03 2023

Crossrefs

Equals A085059(n)-1.
Cf. A076042 (based on squares).

Programs

  • Haskell
    a008344 n = a008344_list !! (n-1)
    a008344_list = 0 : f 0 [1..] where
       f x (z:zs) = y : f y zs where y = if x < z then x + z else x - z
    -- Reinhard Zumkeller, Oct 17 2014, May 08 2012
    
  • Maple
    A008344 := proc(n) option remember; if n = 0 then 0 elif A008344(n-1) >= (n-1) then A008344(n-1)-(n-1) else A008344(n-1)+(n-1); fi; end;
  • Mathematica
    a[1]=0; a[n_] := a[n]=If[a[n-1]>=n-1, a[n-1]-n+1, a[n-1]+n-1]
    Transpose[ NestList[ If[First[#]>=Last[#],{First[#]-Last[#],Last[#]+1}, {First[#]+Last[#],Last[#]+1}]&,{0,1},80]][[1]] (* Harvey P. Dale, Jun 20 2011 *)
    s = 0; Table[If[s < n, s = s + n, s = s - n], {n, 0, 80}] (* Horst H. Manninger, Dec 03 2018 *)
  • PARI
    a(n) = my(expo = logint(2*n+1, 3), res = n - (3^expo-1)/2); if(res==0, 0, if(res%2, (3^expo-res)/2, 3^expo-1+res/2)) \\ Jianing Song, May 25 2021

Formula

This is a concatenation S_0, S_1, S_2, ... where S_i = [b_0, b_1, ..., b_{3^(i+1)-1}] with b_0 = 0, b_{2j-1} = k+1-j, b_{2j} = 2k+j (j=1..k), k=(3^(i+1)-1)/2. E.g. S_0 = [0, 1, 3], S_1 = [0, 4, 9, 3, 10, 2, 11, 1, 12].
a((3^n-1)/2) = 0; a((3^n-1)/2 + 2k-1) = (3^n+1)/2 - k for 1 <= k <= (3^n-1)/2; a((3^n-1)/2 + 2k) = 3^n - 1 + k for 1 <= k < (3^n-1)/2. - Benoit Cloitre, Jan 09 2003 [Corrected by Jianing Song, May 25 2021]
a(n) = (n-1+a(n-1)) mod (2*(n-1)). - Jon Maiga, Jul 09 2021

Extensions

Name edited by Dmitry Kamenetsky, Feb 14 2017

A168613 a(n) = 3^n - 5.

Original entry on oeis.org

-4, -2, 4, 22, 76, 238, 724, 2182, 6556, 19678, 59044, 177142, 531436, 1594318, 4782964, 14348902, 43046716, 129140158, 387420484, 1162261462, 3486784396, 10460353198, 31381059604, 94143178822, 282429536476, 847288609438
Offset: 0

Views

Author

Vincenzo Librandi, Dec 01 2009

Keywords

Crossrefs

Cf. A168610.

Programs

  • Magma
    I:=[-4, -2]; [n le 2 select I[n] else 4*Self(n-1)-3*Self(n-2): n in [1..30]]; // Vincenzo Librandi, Jul 06 2012
  • Mathematica
    CoefficientList[Series[2*(7*x-2)/((1-x)*(1-3*x)),{x,0,40}],x] (* Vincenzo Librandi, Jul 06 2012 *)
    LinearRecurrence[{4,-3}, {-4, -2}, 25] (* G. C. Greubel, Jul 27 2016 *)
    3^Range[0,30]-5 (* Harvey P. Dale, Sep 12 2022 *)

Formula

a(n) = 3*a(n-1) + 10 with a(0)=-4.
G.f.: 2*(7*x - 2)/((1-x)*(1-3*x)). - Vincenzo Librandi, Jul 06 2012
a(n) = 4*a(n-1) - 3*a(n-2). - Vincenzo Librandi, Jul 06 2012
a(n) = 2*A116970(n) + 2 with A116970(0)=-3, A116970(1)=-2. - Bruno Berselli, Jul 06 2012
E.g.f.: exp(3*x) - 5*exp(x). - G. C. Greubel, Jul 27 2016

Extensions

Formula and examples edited to use correct offset by Jon E. Schoenfield, Jun 19 2010

A063679 Numbers k such that (3^k - 7)/2 is prime.

Original entry on oeis.org

4, 12, 18, 26, 106, 164, 246, 956, 2554, 3350, 6496, 8706, 9008, 15398, 15490, 20408, 39240, 41060, 41842, 58358, 60346, 82214, 134972, 194014, 344204, 587712, 778070
Offset: 1

Views

Author

Jud McCranie, Jul 28 2001

Keywords

Comments

x = 3^k is a solution to sigma(x - 7) = sigma(x) - 7 when (3^k - 7)/2 is prime.
a(28) > 10^6

Examples

			(3^4 - 7)/2 = 37 is prime, so 4 is in the sequence.
		

Crossrefs

Programs

  • Maple
    with(numtheory):i := 0:x := 1:while i < 1000 do i := i+1:x := 3*x: if isprime((x-7)/2) then print(i):fi:od:
  • Mathematica
    Do[ If[ PrimeQ[ (3^n - 7)/2 ], Print[n] ], {n, 2, 5500} ]
    Select[Range[2, 10000], PrimeQ[((3^# - 7)/2)] &] (* Vincenzo Librandi, Sep 30 2012 *)
  • PARI
    is(n)=ispseudoprime((3^n-7)/2) \\ Charles R Greathouse IV, May 22 2017

Extensions

More terms from Robert G. Wilson v, Aug 02 2001
0, 1 removed and a(11)-a(13) added from Vincenzo Librandi, Sep 30 2012
a(14)-a(17) from Seth A. Troisi, Oct 17 2022
a(17) corrected, a(18)-a(25) from Seth A. Troisi, Oct 29 2022
a(26)-a(27) from Seth A. Troisi, Nov 28 2022

A277105 a(n) = (27*3^n - 63)/2.

Original entry on oeis.org

9, 90, 333, 1062, 3249, 9810, 29493, 88542, 265689, 797130, 2391453, 7174422, 21523329, 64570050, 193710213, 581130702, 1743392169, 5230176570, 15690529773, 47071589382, 141214768209, 423644304690, 1270932914133, 3812798742462, 11438396227449, 34315188682410, 102945566047293, 308836698141942, 926510094425889
Offset: 1

Views

Author

Emeric Deutsch, Nov 05 2016

Keywords

Comments

a(n) is the second Zagreb index of the Hanoi graph H[n] (n>=2).
The second Zagreb index of a simple connected graph g is the sum of the degree products d(i)d(j) over all edges ij of g.
The M-polynomial of the Hanoi graph H[n] is M(H[n],x,y) = 6*x^2*y^3 + (3/2)*(3^n - 5)*x^3*y^3.

Crossrefs

Programs

  • Magma
    [(27*3^n-63)/2: n in [1..30]]; // Bruno Berselli, Nov 14 2016
  • Maple
    seq((1/2)*(9*(3^(n+1)-7)), n = 1..30);
  • Mathematica
    Table[(27 3^n - 63)/2, {n, 1, 30}] (* Bruno Berselli, Nov 14 2016 *)

Formula

O.g.f.: 9*x*(1 + 6*x)/((1 - x)*(1 - 3*x)).
E.g.f.: 9*(1 - exp(x))*(4 - 3*exp(x) - 3*exp(2*x))/2. - Bruno Berselli, Nov 14 2016
a(n) = 9*A116970(n+1).
Showing 1-4 of 4 results.