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.

A309407 a(n) = round(sqrt(3*n + 9/4)), with a(0) = 1.

Original entry on oeis.org

1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16
Offset: 0

Views

Author

Ed Pegg Jr, Jul 29 2019

Keywords

Comments

Diverges from A046693 at positions in A308766.
For the first 1750 terms, A046693(n)-a(n) is either 0 or 1.

Crossrefs

Programs

  • Mathematica
    Table[If[n == 0, 1, Round[Sqrt[3 n + 9/4]]], {n, 0, 88}]
  • PARI
    a(n) = if (n, round(sqrt(3*n + 9/4)), 1); \\ Michel Marcus, Jan 18 2022
    
  • Python
    from math import isqrt
    from sympy import integer_nthroot
    def A309407(n):
        if n == 0: return 1
        a, b = integer_nthroot(12*n+9,2)
        return a-(c:=isqrt(3*n+2))-(b&(c&1^1)) # Chai Wah Wu, Jun 19 2024

Formula

a(n) = round(sqrt(3*n + 9/4)).
From Michael Chu, Jan 17 2022: (Start)
a(12*k^2 - 6*k) = 6*k - 2 for k>0.
a(12*k^2 + 6*k) = 6*k + 2 for k>0. (End)