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.

Previous Showing 11-15 of 15 results.

A357562 a(n) = n - 2*b(b(n)) for n >= 2, where b(n) = A356988(n).

Original entry on oeis.org

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

Views

Author

Peter Bala, Oct 14 2022

Keywords

Comments

a(n+1) - a(n) is equal to 1 or -1.
The sequence vanishes at abscissa values n = 2, 4, 6, 10, 16, 26, ..., 2*Fibonacci(k), .... For k >= 2, the line graph of the sequence, starting from the zero value at abscissa n = 2*Fibonacci(k), ascends with slope 1 to a local peak at height Fibonacci(k-1) at abscissa value n = Fibonacci(k+2) before descending with slope -1 to the next zero at abscissa n = 2*Fibonacci(k+1).
a(n) = the distance to the nearest number of the form 2*Fibonacci(k). Cf. A053646.

Crossrefs

Programs

  • Maple
    # b(n) = A356988(n)
    b := proc(n) option remember; if n = 1 then 1 else n - b(b(n - b(b(b(n-1))))) end if; end proc:
    seq( n - 2*b(b(n)), n = 2..100);

Formula

For k >= 2 there holds
a(2*Fibonacci(k) + j ) = j for 0 <= j <= Fibonacci(k-1) and
a(Fibonacci(k+2) + j) = Fibonacci(k-1) - j for 0 <= j <= Fibonacci(k-1).

A342872 Distance to nearest product of 3 consecutive numbers (three-dimensional promic number, A007531).

Original entry on oeis.org

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

Views

Author

Lamine Ngom, Mar 28 2021

Keywords

Examples

			a(13) = 7 since 6 is the closest three-dimensional promic to 13 and 13 - 6 = 7.
		

Crossrefs

Other distance to nearest: A081134, A053646, A201053.

Programs

  • Python
    def a(n): return min(abs(n-k*(k+1)*(k+2)) for k in range(int(n**1/3)+1))
    print([a(n) for n in range(78)]) # Michael S. Branicky, Mar 28 2021

A080776 Oscillating sequence which rises to 2^(k-1) in k-th segment (k>=1) then falls back to 0.

Original entry on oeis.org

0, 0, 1, 0, 1, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 31, 30
Offset: 0

Views

Author

N. J. A. Sloane, Mar 11 2003

Keywords

Comments

k-th segment has length 2^k (k>=0).

References

  • Hsien-Kuei Hwang, S Janson, TH Tsai, Exact and asymptotic solutions of the recurrence f(n) = f(floor(n/2)) + f(ceiling(n/2)) + g(n): theory and applications, Preprint, 2016; http://140.109.74.92/hk/wp-content/files/2016/12/aat-hhrr-1.pdf. Also Exact and Asymptotic Solutions of a Divide-and-Conquer Recurrence Dividing at Half: Theory and Applications, ACM Transactions on Algorithms, 13:4 (2017), #47; DOI: 10.1145/3127585

Crossrefs

Essentially the same as A053646.

Formula

G.f.: -1 + 2/(1-x) + 1/(1-x)^2 * (-1 + sum(k>=0, 2t^2(t-1), t=x^2^k)). a(n) = A005942(n+2) - 3(n+1), n>0. - Ralf Stephan, Sep 13 2003
a(0)=0, a(2n) = a(n) + a(n-1) + (n==1), a(2n+1) = 2a(n). - Ralf Stephan, Oct 20 2003

A302558 For any n > 0 and m > 1, let d_m(n) be the distance from n to the nearest power of a number <= m (i.e., the distance to the nearest number of the form x^k with x <= m and k >= 0); a(n) = Sum_{i > 1} d_i(n).

Original entry on oeis.org

0, 0, 1, 0, 3, 7, 5, 0, 1, 9, 18, 28, 30, 23, 13, 0, 15, 31, 48, 66, 73, 64, 50, 33, 11, 29, 5, 29, 54, 55, 29, 0, 31, 63, 41, 16, 51, 87, 124, 162, 201, 241, 252, 231, 207, 180, 150, 117, 73, 113, 152, 192, 233, 275, 318, 362, 364, 321, 275, 226, 174, 119, 61
Offset: 1

Views

Author

Rémy Sigrist, Aug 15 2018

Keywords

Comments

For any n > 1 and m >= n, d_m(n) = 0, hence the series in the name contains only finitely many nonzero terms and is well defined.
The set of local minima (i.e., indices n > 1 where a(n) < min(a(n-1), a(n+1))) seem to correspond to A001597 minus {1, 9}.
See A303545 for a similar sequence.

Examples

			For n = 10:
- d_2(10) = |10 - 8| = 2,
- d_m(10) = |10 - 9| = 1 for m = 3..9,
- d_m(10) = 0 for any m >= 10,
- hence a(10) = 2 + 7*1 = 9.
		

Crossrefs

Programs

  • PARI
    a(n) = my (v=0, d=oo); for (m=2, oo, my (k=logint(n,m)); d = min(d, min(n-m^k, m^(k+1)-n)); if (d, v+=d, return (v)))

Formula

a(n) = 0 iff n is a power of 2.
a(n) >= A053646(n) (as d_2 = A053646).

A302721 Square array T(n, k) read by antidiagonals upwards, n > 0 and k > 0: T(n, k) is the distance from n to the nearest prime(k)-smooth number (where prime(k) denotes the k-th prime number).

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Rémy Sigrist, Apr 29 2018

Keywords

Examples

			Array T(n, k) begins:
  n\k|  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20
  ---+------------------------------------------------------------
    1|  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    2|  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    3|  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    4|  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    5|  1  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    6|  2  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    7|  1  1  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    8|  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    9|  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
   10|  2  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
   11|  3  1  1  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
   12|  4  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
   13|  3  1  1  1  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
		

Crossrefs

Cf. A053646 (first column), A061395, A301574 (second column), A303545 (row sums).

Programs

  • PARI
    gpf(n) = if (n==1, 1, my (f=factor(n)); f[#f~, 1])
    T(n,k) = my (p=prime(k)); for (d=0, oo, if (gpf(n-d) <= p || gpf(n+d) <= p, return (d)))

Formula

a(2^i, k) = 0 for any i >= 0.
a(2*n, k) <= 2*a(n, k).
a(n, k+1) <= a(n, k).
abs(T(n+1, k) - T(n, k)) <= 1.
a(n, A061395(n)) = 0 for any n > 1.
a(n, 1) = A053646(n).
a(n, 2) = A301574(n).
Sum_{k > 0} a(n, k) = A303545(n).
Previous Showing 11-15 of 15 results.