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-6 of 6 results.

A278586 Start with X = n^2. Repeatedly replace X with X - ceiling(X/n); a(n) is the number of steps to reach 0.

Original entry on oeis.org

1, 3, 5, 8, 11, 14, 17, 21, 24, 28, 32, 36, 40, 44, 49, 53, 57, 62, 66, 71, 75, 80, 84, 90, 94, 99, 103, 109, 113, 118, 123, 128, 133, 139, 143, 149, 154, 159, 164, 170, 175, 180, 185, 191, 196, 201, 207, 212, 217, 223, 229, 234, 240, 246, 251, 256, 262, 268, 273, 279, 284, 290, 296, 302, 308
Offset: 1

Views

Author

N. J. A. Sloane, Dec 02 2016, based on discussions about the Pythagoras article in the Sequence Fans Mailing List, Dec 01 2016. Jack Brennen provided the definition given here

Keywords

Crossrefs

Cf. A052488.

Programs

  • Magma
    a:=[]; for n in [1..58] do k:=n^2; count:=0; while k gt 0 do count+:=1; k-:=Ceiling(k/n); end while; a[n]:=count; end for; a; // Jon E. Schoenfield, Dec 01 2016
  • Maple
    A278586 := proc(n)
        local x,a;
        x := n^2 ;
        a := 0 ;
        while x <> 0 do
            x:= x-ceil(x/n) ;
            a := a+1 ;
        end do:
        a;
    end proc: # R. J. Mathar, Dec 02 2016
  • Mathematica
    f[n_] := Length@ NestWhileList[# - Ceiling[#/n] &, n^2, # > 1 &]; Array[f, 65] (* Robert G. Wilson v, Dec 01 2016 *)

A060293 Expected coupon collection numbers rounded up; i.e., if aiming to collect a set of n coupons, the expected number of random coupons required to receive the full set.

Original entry on oeis.org

0, 1, 3, 6, 9, 12, 15, 19, 22, 26, 30, 34, 38, 42, 46, 50, 55, 59, 63, 68, 72, 77, 82, 86, 91, 96, 101, 106, 110, 115, 120, 125, 130, 135, 141, 146, 151, 156, 161, 166, 172, 177, 182, 188, 193, 198, 204, 209, 215, 220, 225, 231, 236, 242, 248, 253, 259, 264, 270
Offset: 0

Views

Author

Henry Bottomley, Mar 24 2001

Keywords

Examples

			a(2)=3 since the probability of getting both coupons after two is 1/2, after 3 is 1/4, after 4 is 1/8, etc. and 2/2 + 3/2^2 + 4/2^3 + ... = 3.
		

Crossrefs

Cf. A052488.

Programs

  • Maple
    H := proc(n)
        add(1/k,k=1..n) ;
    end proc:
    A060293 := proc(n)
        ceil(n*H(n)) ;
    end proc: # R. J. Mathar, Aug 02 2009, Dec 02 2016
    A060293:= n -> ceil(Psi(n+1)+gamma); # Robert Israel, May 19 2014
  • Mathematica
    f[n_] := Ceiling[n*HarmonicNumber[n]]; Array[f, 60, 0] (* Robert G. Wilson v, Nov 23 2015 *)
  • PARI
    vector(100, n, n--; ceil(n*sum(k=1, n, 1/k))) \\ Altug Alkan, Nov 23 2015
    
  • Python
    from math import ceil
    n=100 #number of terms
    ans=0
    finalans = [0]
    for i in range(1, n+1):
        ans+=(1/i)
        finalans.append(ceil(ans*i))
    print(finalans)
    # Adam Hugill, Feb 14 2022

Formula

a(n) = ceiling(n*Sum_{k=1..n}(1/k)) = ceiling(n*A001008(n)/A002805(n)) = A052488(n) + 1 for n>2.

A102722 Given n, sum all division remainders {n/k}, with k=1,...,n. The value a(n) is given by the floor of that sum. Note that {x}:=x-[x].

Original entry on oeis.org

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

Views

Author

Carlos Alves, Feb 06 2005

Keywords

Comments

Conjecture: a(n) ~ (1-EulerGamma)n.

Examples

			a(5) = [{5/1}+{5/2}+{5/3}+{5/4}+{5/5}]=[0+0.5+0.6666+0.25+0]=[1.4166]=1 (division by 1 or by the number itself is to be avoided).
		

Crossrefs

Programs

  • Maple
    N:= 100:
    H:= ListTools:-PartialSums([seq(1/n,n=1..N)]):
    S:= ListTools:-PartialSums(map(numtheory:-tau,[$1..N])):
    seq(floor(n*H[n])-S[n],n=1..N); # Robert Israel, Mar 20 2016
  • Mathematica
    Resto = Function[n, Sum[n/k - Floor[n/k], {k, 2, n - 1}]]; Floor[Map[Resto, Range[1, 1000]]]
    Table[Floor[n*HarmonicNumber[n]] - Sum[DivisorSigma[0, k], {k, 1, n}], {n, 1, 200}] (* Enrique Pérez Herrero, Aug 25 2009 *)
    Table[Floor[Sum[FractionalPart[n/k], {k, 1, n}]], {n, 1, 200}] (* Enrique Pérez Herrero, Aug 25 2009 *)
  • Python
    from math import isqrt
    from sympy import harmonic
    def A102722(n): return int(n*harmonic(n))+(s:=isqrt(n))**2-(sum(n//k for k in range(1,s+1))<<1) # Chai Wah Wu, Oct 24 2023

Formula

a(n) = floor(n*H(n)) - Sum_{j=1..n} d(j), where d(n)=A000005(n) is the number of divisors of n, and H(n) is the n-th Harmonic Number. [Enrique Pérez Herrero, Aug 25 2009; corrected by Robert Israel, Mar 20 2016]
a(n) = A052488(n) - A006218(n). [Enrique Pérez Herrero, Aug 25 2009]

A135736 Nearest integer to n*Sum_{k=1..n} 1/k = rounded expected coupon collection numbers.

Original entry on oeis.org

0, 1, 3, 6, 8, 11, 15, 18, 22, 25, 29, 33, 37, 41, 46, 50, 54, 58, 63, 67, 72, 77, 81, 86, 91, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 161, 166, 171, 176, 182, 187, 192, 198, 203, 209, 214, 219, 225, 230, 236, 242, 247, 253, 258, 264, 269, 275
Offset: 0

Views

Author

M. F. Hasler, Nov 29 2007

Keywords

Comments

Somewhat more realistic than A052488 but more optimistic than A060293, the expected number of boxes that must be bought to get the full collection of N objects, if each box contains any one of them at random. See also comments in A060293, A052488.

Examples

			a(0) = 0 since nothing needs to be bought if nothing is to be collected.
a(1) = 1 since only 1 box needs to be bought if only 1 object is to be collected.
a(2) = 3 since the chance of getting the other object at the second purchase is only 1/2, so it takes 2 boxes on the average to get it.
a(3) = 6 since the chance of getting a new object at the second purchase is 2/3 so it takes 3/2 boxes in the mean, then the chance becomes 1/3 to get the 3rd, i.e., 3 other boxes on the average to get the full collection and the rounded value of 1 + 3/2 + 3 = 11/2 = 5.5 is 6.
		

Crossrefs

Programs

  • Maple
    seq(round(n*harmonic(n)), n=1..100); # Robert Israel, Oct 31 2016
  • Mathematica
    Table[Round[n*Sum[1/k, {k, 1, n}]], {n,0,25}] (* G. C. Greubel, Oct 29 2016 *)
  • PARI
    A135736(n)=round(n*sum(i=1,n,1/i))
    
  • Python
    n=100 #set the number of terms you want to calculate here
    ans=0
    finalans = []
    finalans.append(0) #continuity with A135736
    for i in range(1, n+1):
        ans+=(1/i)
        finalans.append(int(round(ans*i)))
    print(finalans)
    # Adam Hugill, Feb 14 2022

Formula

a(n) = round(n*A001008(n)/A002805(n)) = either A052488(n) or A060293(n).
a(n) ~ A060293(n) ~ A052488(n) ~ A050502(n) ~ A050503(n) ~ A050504(n) (asymptotically)
Conjecture: a(n) = round(n*(log(n) + gamma) + 1/2) for n > 0, where gamma = A001620. - Ilya Gutkovskiy, Oct 31 2016
The conjecture is false: a(2416101) = 36905656 while round(2416101*(log(2416101) + gamma) + 1/2) = 36905657, with the unrounded numbers being 36905656.499999982... and 36905656.500000016.... Heuristically this should happen infinitely often. - Charles R Greathouse IV, Oct 31 2016

A079447 Primes p such that there is an integer k satisfying p = floor(k*H(k)) where H(k) denotes the k-th harmonic number (i.e., H(k) = 1 + 1/2 + 1/3 + ... + 1/k).

Original entry on oeis.org

3, 5, 11, 29, 37, 41, 67, 71, 109, 181, 197, 241, 263, 269, 349, 367, 373, 379, 397, 409, 421, 433, 439, 457, 463, 487, 587, 593, 599, 631, 701, 727, 773, 911, 971, 991, 1039, 1093, 1223, 1237, 1279, 1307, 1321, 1433, 1447, 1489, 1553, 1567, 1667, 1747, 1783
Offset: 1

Views

Author

Benoit Cloitre, Jan 13 2003

Keywords

Examples

			10*Sum_{j=1..10} 1/j = 29.2896825..., hence 29 = floor(10*H(10)) and 29 is in the sequence.
		

Crossrefs

Primes in A052488.

Extensions

Data corrected by Sean A. Irvine, Aug 13 2025

A090541 a(n) = floor((Sum_{r=1..n} r)*(Sum_{r=1..n} 1/r)).

Original entry on oeis.org

1, 4, 11, 20, 34, 51, 72, 97, 127, 161, 199, 242, 289, 341, 398, 459, 526, 597, 674, 755, 842, 933, 1030, 1132, 1240, 1352, 1470, 1594, 1723, 1857, 1997, 2142, 2293, 2450, 2612, 2780, 2953, 3132, 3317, 3508, 3704, 3907, 4115, 4328, 4548, 4774, 5006, 5243
Offset: 1

Views

Author

Amarnath Murthy, Dec 09 2003

Keywords

Comments

For large n, a(n) = floor(n*(n+1)/2)*(log(n) + 0.5772...,(Euler's constant)).

Crossrefs

Cf. A052488.

Programs

  • Maple
    a:=n->floor(sum(k,k=1..n)*sum(1/k,k=1..n)):seq(a(n),n=1..56); # Emeric Deutsch, Apr 18 2005
  • PARI
    a(n) = floor((n*(n+1)/2)*sum(k=1, n, 1/k)); \\ Michel Marcus, Aug 18 2019

Extensions

More terms from Emeric Deutsch, Apr 18 2005
Showing 1-6 of 6 results.