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.

A068626 a(3n) = a(3n-1) = 3*n^2, a(3n-2) = 3*n^2 - 3*n + 1.

Original entry on oeis.org

1, 3, 3, 7, 12, 12, 19, 27, 27, 37, 48, 48, 61, 75, 75, 91, 108, 108, 127, 147, 147, 169, 192, 192, 217, 243, 243, 271, 300, 300, 331, 363, 363, 397, 432, 432, 469, 507, 507, 547, 588, 588, 631, 675, 675, 721, 768, 768, 817, 867, 867, 919, 972, 972, 1027, 1083, 1083, 1141
Offset: 1

Views

Author

Amarnath Murthy, Feb 26 2002

Keywords

Comments

Or, a(1) = 1, a(n) = n + a(n-1) if n does not divide a(n-1) else a(n) = a(n-1). E.g. a(6) = a(5) = 12 as 6 divides 12. a(10) = 10+a(9) = 10+27 = 37.

Crossrefs

Cf. A091684 (first differences).

Programs

  • Magma
    [(n mod 3 eq 1) select (n+2)^2/3 - n-1 else (n+((n mod 3)^2) mod 3 )^2/3  : n in [1..50]]; // Marius A. Burtea, Feb 19 2020
    
  • Mathematica
    LinearRecurrence[{1,0,2,-2,0,-1,1},{1,3,3,7,12,12,19},60] (* Harvey P. Dale, Jun 29 2022 *)
  • PARI
    Vec(x*(1 + 2*x + 2*x^3 + x^4) / ((1 - x)^3*(1 + x + x^2)^2) + O(x^50)) \\ Colin Barker, Feb 19 2020
  • Perl
    my @a = (1); for (my $n = 1; $n <= 90000; $n ++) {
      $a[$n] = $a[$n - 1] + ($a[$n - 1] % $n != 0 ? $n : 0);
      print "$n $a[$n]\n";
    } # Georg Fischer Feb 18 2020
    

Formula

From Colin Barker, Feb 18 2020: (Start)
G.f.: x*(1 + 2*x + 2*x^3 + x^4) / ((1 - x)^3*(1 + x + x^2)^2).
a(n) = a(n-1) + 2*a(n-3) - 2*a(n-4) - a(n-6) + a(n-7) for n>7.
(End)
Sum_{n>=1} 1/a(n) = Pi/sqrt(3)*tanh(Pi/(2*sqrt(3))) + Pi^2/9. - Amiram Eldar, Sep 21 2023

Extensions

Entry revised by N. J. A. Sloane, Mar 13 2006