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

A002024 k appears k times; a(n) = floor(sqrt(2n) + 1/2).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Integer inverse function of the triangular numbers A000217. The function trinv(n) = floor((1+sqrt(1+8n))/2), n >= 0, gives the values 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, ..., that is, the same sequence with offset 0. - N. J. A. Sloane, Jun 21 2009
Array T(k,n) = n+k-1 read by antidiagonals.
Eigensequence of the triangle = A001563. - Gary W. Adamson, Dec 29 2008
Can apparently also be defined via a(n+1)=b(n) for n >= 2 where b(0)=b(1)=1 and b(n) = b(n-b(n-2))+1. Tested to be correct for all n <= 150000. - José María Grau Ribas, Jun 10 2011
For any n >= 0, a(n+1) is the least integer m such that A000217(m)=m(m+1)/2 is larger than n. This is useful when enumerating representations of n as difference of triangular numbers; see also A234813. - M. F. Hasler, Apr 19 2014
Number of binary digits of A023758, i.e., a(n) = ceiling(log_2(A023758(n+2))). - Andres Cicuttin, Apr 29 2016
a(n) and A002260(n) give respectively the x(n) and y(n) coordinates of the sorted sequence of points in the integer lattice such that x(n) > 0, 0 < y(n) <= x(n), and min(x(n), y(n)) < max(x(n+1), y(n+1)) for n > 0. - Andres Cicuttin, Dec 25 2016
Partial sums (A060432) are given by S(n) = (-a(n)^3 + a(n)*(1+6n))/6. - Daniel Cieslinski, Oct 23 2017
As an array, T(k,n) is the number of digits columns used in carryless multiplication between a k-digit number and an n-digit number. - Stefano Spezia, Sep 24 2022
a(n) is the maximum number of possible solutions to an n-statement Knights and Knaves Puzzle, where each statement is of the form "x of us are knights" for some 1 <= x <= n, knights can only tell the truth and knaves can only lie. - Taisha Charles and Brittany Ohlinger, Jul 29 2023

Examples

			From _Clark Kimberling_, Sep 16 2008: (Start)
As a rectangular array, a northwest corner:
  1 2 3 4 5 6
  2 3 4 5 6 7
  3 4 5 6 7 8
  4 5 6 7 8 9
This is the weight array (cf. A144112) of A107985 (formatted as a rectangular array). (End)
G.f. = x + 2*x^2 + 2*x^3 + 3*x^4 + 3*x^5 + 3*x^6 + 4*x^7 + 4*x^9 + 4*x^9 + 4*x^10 + ...
		

References

  • Edward S. Barbeau, Murray S. Klamkin, and William O. J. Moser, Five Hundred Mathematical Challenges, Prob. 441, pp. 41, 194. MAA 1995.
  • R. L. Graham, D. E. Knuth, and O. Patashnik, Concrete Mathematics. Addison-Wesley, Reading, MA, 1990, p. 97.
  • K. Hardy and K. S. Williams, The Green Book of Mathematical Problems, p. 59, Solution to Prob. 14, Dover NY, 1985
  • R. Honsberger, Mathematical Morsels, pp. 133-134, MAA 1978.
  • J. F. Hurley, Litton's Problematical Recreations, pp. 152; 313-4 Prob. 22, VNR Co., NY, 1971.
  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 1, p. 43.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 129.

Crossrefs

a(n+1) = 1+A003056(n), A022846(n)=a(n^2), a(n+1)=A002260(n)+A025581(n).
A123578 is an essentially identical sequence.

Programs

  • Haskell
    a002024 n k = a002024_tabl !! (n-1) !! (k-1)
    a002024_row n = a002024_tabl !! (n-1)
    a002024_tabl = iterate (\xs@(x:_) -> map (+ 1) (x : xs)) [1]
    a002024_list = concat a002024_tabl
    a002024' = round . sqrt . (* 2) . fromIntegral
    -- Reinhard Zumkeller, Jul 05 2015, Feb 12 2012, Mar 18 2011
    
  • Haskell
    a002024_list = [1..] >>= \n -> replicate n n
    
  • Haskell
    a002024 = (!!) $ [1..] >>= \n -> replicate n n
    -- Sascha Mücke, May 10 2016
    
  • Magma
    [Floor(Sqrt(2*n) + 1/2): n in [1..80]]; // Vincenzo Librandi, Nov 19 2014
    
  • Maple
    A002024 := n-> ceil((sqrt(1+8*n)-1)/2); seq(A002024(n), n=1..100);
  • Mathematica
    a[1] = 1; a[n_] := a[n] = a[n - a[n - 1]] + 1 (* Branko Curgus, May 12 2009 *)
    Table[n, {n, 13}, {n}] // Flatten (* Robert G. Wilson v, May 11 2010 *)
    Table[PadRight[{},n,n],{n,15}]//Flatten (* Harvey P. Dale, Jan 13 2019 *)
  • PARI
    t1(n)=floor(1/2+sqrt(2*n)) /* A002024 = this sequence */
    
  • PARI
    t2(n)=n-binomial(floor(1/2+sqrt(2*n)),2) /* A002260(n-1) */
    
  • PARI
    t3(n)=binomial(floor(3/2+sqrt(2*n)),2)-n+1 /* A004736 */
    
  • PARI
    t4(n)=n-1-binomial(floor(1/2+sqrt(2*n)),2) /* A002260(n-1)-1 */
    
  • PARI
    A002024(n)=(sqrtint(n*8)+1)\2 \\ M. F. Hasler, Apr 19 2014
    
  • PARI
    a(n)=(sqrtint(8*n-7)+1)\2
    
  • PARI
    a(n)=my(k=1);while(binomial(k+1,2)+1<=n,k++);k \\ R. J. Cano, Mar 17 2014
    
  • Python
    from math import isqrt
    def A002024(n): return (isqrt(8*n)+1)//2 # Chai Wah Wu, Feb 02 2022
  • Sage
    [floor(sqrt(2*n) +1/2) for n in (1..80)] # G. C. Greubel, Dec 10 2018
    

Formula

a(n) = floor(1/2 + sqrt(2n)). Also a(n) = ceiling((sqrt(1+8n)-1)/2). [See the Liu link for a large collection of explicit formulas. - N. J. A. Sloane, Oct 30 2019]
a((k-1)*k/2 + i) = k for k > 0 and 0 < i <= k. - Reinhard Zumkeller, Aug 30 2001
a(n) = a(n - a(n-1)) + 1, with a(1)=1. - Ian M. Levitt (ilevitt(AT)duke.poly.edu), Aug 18 2002
a(n) = round(sqrt(2n)). - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Nov 01 2002
T(n,k) = A003602(A118413(n,k)); = T(n,k) = A001511(A118416(n,k)). - Reinhard Zumkeller, Apr 27 2006
G.f.: (x/(1-x))*Product_{k>0} (1-x^(2*k))/(1-x^(2*k-1)). - Vladeta Jovovic, Oct 06 2003
Equals A127899 * A004736. - Gary W. Adamson, Feb 09 2007
Sum_{i=1..n} Sum_{j=i..n+i-1} T(j,i) = A000578(n); Sum_{i=1..n} T(n,i) = A000290(n). - Reinhard Zumkeller, Jun 24 2007
a(n) + n = A014132(n). - Vincenzo Librandi, Jul 08 2010
a(n) = ceiling(-1/2 + sqrt(2n)). - Branko Curgus, May 12 2009
a(A169581(n)) = A038567(n). - Reinhard Zumkeller, Dec 02 2009
a(n) = round(sqrt(2*n)) = round(sqrt(2*n-1)); there exist a and b greater than zero such that 2*n = 2+(a+b)^2 -(a+3*b) and a(n)=(a+b-1). - Fabio Civolani (civox(AT)tiscali.it), Feb 23 2010
A005318(n+1) = 2*A005318(n) - A205744(n), A205744(n) = A005318(A083920(n)), A083920(n) = n - a(n). - N. J. A. Sloane, Feb 11 2012
Expansion of psi(x) * x / (1 - x) in powers of x where psi() is a Ramanujan theta function. - Michael Somos, Mar 19 2014
G.f.: (x/(1-x)) * Product_{n>=1} (1 + x^n) * (1 - x^(2*n)). - Paul D. Hanna, Feb 27 2016
a(n) = 1 + Sum_{i=1..n/2} ceiling(floor(2(n-1)/(i^2+i))/(2n)). - José de Jesús Camacho Medina, Jan 07 2017
a(n) = floor((sqrt(8*n-7)+1)/2). - Néstor Jofré, Apr 24 2017
a(n) = floor((A000196(8*n)+1)/2). - Pontus von Brömssen, Dec 10 2018
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/4 (A003881). - Amiram Eldar, Oct 01 2022
G.f. as array: (x^2*(1 - y)^2 + y^2 + x*y*(1 - 2*y))/((1 - x)^2*(1 - y)^2). - Stefano Spezia, Apr 22 2024

A007917 Version 1 of the "previous prime" function: largest prime <= n.

Original entry on oeis.org

2, 3, 3, 5, 5, 7, 7, 7, 7, 11, 11, 13, 13, 13, 13, 17, 17, 19, 19, 19, 19, 23, 23, 23, 23, 23, 23, 29, 29, 31, 31, 31, 31, 31, 31, 37, 37, 37, 37, 41, 41, 43, 43, 43, 43, 47, 47, 47, 47, 47, 47, 53, 53, 53, 53, 53, 53, 59, 59, 61, 61, 61, 61, 61, 61, 67, 67, 67, 67, 71, 71, 73, 73, 73, 73
Offset: 2

Views

Author

R. Muller

Keywords

Comments

Version 2 of the "previous prime" function (see A151799) is "largest prime < n". This produces the same sequence of numerical values, except the offset (or indexing) starts at 3 instead of 2.
Maple's "prevprime" function uses version 2.
Also the largest prime dividing n! or lcm(1,...,n). - Labos Elemer, Jun 22 2000
Also largest prime among terms of (n+1)st row of Pascal's triangle. - Jud McCranie, Jan 17 2000
Also largest integer k such that A000203(k) <= n+1. - Benoit Cloitre, Mar 17 2002. - Corrected by Antti Karttunen, Nov 07 2017
Also largest prime factor of A061355(n) (denominator of Sum_{k=0..n} 1/k!). - Jonathan Sondow, Jan 09 2005
Also prime(pi(x)) where pi(x) is the prime counting function = number of primes <= x. - Cino Hilliard, May 03 2005
Also largest prime factor, occurring to the power p, in denominator of Sum_{k=1..n} 1/k^p, for any positive integer p. - M. F. Hasler, Nov 10 2006
For n > 10, these values are close to the most negative eigenvalues of A191898 (conjecture). - Mats Granvik, Nov 04 2011

References

  • K. Atanassov, On the 37th and the 38th Smarandache Problems, Notes on Number Theory and Discrete Mathematics, Sophia, Bulgaria, Vol. 5 (1999), No. 2, 83-85.
  • J. Castillo, Other Smarandache Type Functions: Inferior/Superior Smarandache f-part of x, Smarandache Notions Journal, Vol. 10, No. 1-2-3, 1999, 202-204.

Crossrefs

Programs

Formula

Equals A006530(A000142(n)). - Jonathan Sondow, Jan 09 2005
Equals A006530(A056040(n)). - Peter Luschny, Mar 04 2011
a(n) = A000040(A049084(A007918(n)) + 1 - A010051(n)). - Reinhard Zumkeller, Jul 26 2012
From Wesley Ivan Hurt, May 22 2013: (Start)
omega( Product_{i=2..n} a(i) ) = pi(n).
Omega( Product_{i=2..n} a(i) ) = n - 1. (End)
For n >= 2, a(A000203(n)) = A070801(n). - Antti Karttunen, Nov 07 2017
a(n) = n + 1 - Sum_{i=1..n} floor(pi(i)/pi(n)) = n + 1 - A175851(n). - Ridouane Oudra, Jun 24 2024
Conjecture: a(n) = floor(log(Sum_{k=2..n} exp(A000010(k)+1))). - Joseph M. Shunia, Aug 09 2024
a(n) = A000040(A000720(n)). - Ridouane Oudra, Oct 04 2024

Extensions

Edited by N. J. A. Sloane, Apr 06 2008

A031368 Odd-indexed primes: a(n) = prime(2n-1).

Original entry on oeis.org

2, 5, 11, 17, 23, 31, 41, 47, 59, 67, 73, 83, 97, 103, 109, 127, 137, 149, 157, 167, 179, 191, 197, 211, 227, 233, 241, 257, 269, 277, 283, 307, 313, 331, 347, 353, 367, 379, 389, 401, 419, 431, 439, 449, 461, 467, 487, 499, 509, 523, 547, 563
Offset: 1

Views

Author

Keywords

Comments

Appeared as a puzzle in "Stickelers", a nationally distributed feature, by Terry Stickels, Sep 28 2006. - Franklin T. Adams-Watters, Sep 28 2006
Also every second prime starting with 2. - Cino Hilliard, Dec 02 2007
Central terms of the triangle in A005145. - Reinhard Zumkeller, Aug 05 2009

Crossrefs

Cf. A000040, A031215 (even-indexed primes), A005408.
First differences are A155067.

Programs

  • Haskell
    a031368 = a000040 . ((subtract 1) . (* 2))
    a031368_list = map a000040 [1, 3 ..]  -- Reinhard Zumkeller, Nov 25 2012
    
  • Magma
    [ NthPrime(2*n-1): n in [1..1000] ]; // Vincenzo Librandi, Apr 11 2011
    
  • Maple
    A031368 := n->ithprime(2*n-1): seq(A031368(n), n=1..100);
  • Mathematica
    Table[ Prime[ 2n -1], {n, 52}] (* Robert G. Wilson v, Dec 01 2013 *)
  • PARI
    a(n) = prime(2*n-1) \\ Jianing Song, Jun 03 2021

Formula

a(n) = A219603(n) / A000040(n). - Reinhard Zumkeller, Nov 25 2012

A033286 a(n) = n * prime(n).

Original entry on oeis.org

2, 6, 15, 28, 55, 78, 119, 152, 207, 290, 341, 444, 533, 602, 705, 848, 1003, 1098, 1273, 1420, 1533, 1738, 1909, 2136, 2425, 2626, 2781, 2996, 3161, 3390, 3937, 4192, 4521, 4726, 5215, 5436, 5809, 6194, 6513, 6920, 7339, 7602, 8213, 8492, 8865, 9154, 9917
Offset: 1

Views

Author

Keywords

Comments

Does an n exist such that n*prime(n)/(n+prime(n)) is an integer? - Ctibor O. Zizka, Mar 04 2008. The answer to Zizka's question is easily seen to be No: such an integer k would be positive and less than prime(n), but then k*(n + prime(n)) = prime(n)*n would be impossible. - Robert Israel, Apr 20 2015
Sums of rows of the triangle in A005145. - Reinhard Zumkeller, Aug 05 2009
Complement of A171520(n). - Jaroslav Krizek, Dec 13 2009
Partial sums of A090942. - Omar E. Pol, Apr 20 2015

Crossrefs

Cf. A005145 (primes repeated), A171520 (complement), A076146 (iterated).

Programs

Formula

a(n) = n * A000040(n) = n * A008578(n+1) = n * A158611(n+2). - Jaroslav Krizek, Aug 31 2009
a(n) = A007504(n) + A152535(n). - Omar E. Pol, Aug 09 2012
Sum_{n>=1} 1/a(n) = A124012. - Amiram Eldar, Oct 15 2020

Extensions

Correction for change of offset in A158611 and A008578 in Aug 2009 from Jaroslav Krizek, Jan 27 2010

A175944 1 appears once, n-th prime p appears p times.

Original entry on oeis.org

1, 2, 2, 3, 3, 3, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Oct 27 2010

Keywords

Comments

a(A014284(n)) = a(A175965(n)) = A018252(n). [Reinhard Zumkeller, Mar 18 2011]
This is how A063905 would have been reckoned at the beginning of the 20th century, taking the primes as given in A008578 instead of the way they are given in A000040. [Alonso del Arte, Sep 09 2011]

Crossrefs

Cf. A063905.
Cf. A005145.

Programs

  • Haskell
    a175944 n = a175944_list !! (n-1)
    a175944_list =
       concat $ zipWith ($) (map replicate a018252_list) a018252_list
    -- Reinhard Zumkeller, Mar 18 2011
  • Mathematica
    Join[{1}, Flatten[Table[Prime[n], {n, 8}, {Prime[n]}]]] (* Alonso del Arte, Sep 08 2011 based on Robert G. Wilson v's program for A002024 *)
    Join[{1},Flatten[Table[PadRight[{},n,n],{n,Prime[Range[10]]}]]] (* Harvey P. Dale, May 16 2019 *)

Formula

a(1)=1, a(n)=A063905(n-1) for n>1.

A098962 Smallest sequence such that over all terms each prime p occurs exactly p times as prime factor; a(1)=1.

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 11, 13, 15, 17, 19, 23, 25, 29, 31, 35, 37, 41, 43, 47, 49, 53, 59, 61, 67, 71, 73, 77, 79, 83, 89, 91, 97, 101, 103, 107, 109, 113, 119, 121, 127, 131, 137, 139, 143, 149, 151, 157, 163, 167, 169, 173, 179, 181, 187, 191, 193, 197, 199, 209, 211
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 22 2004

Keywords

Comments

A000040 is a subsequence.
A099619 gives k such that a(k) = n-th prime; A099620 gives the greatest term divisible by the n-th prime.
A001222(a(n)) <= 2.

Examples

			p=2: a(2)=2, a(5)=6=2*3: 4=2*2 is missing, otherwise 2 would occur more than 2 times, there are no more even terms greater than 6;
p=3: a(3)=3, a(5)=6=2*3, a(9)=15=3*5: 9=3*3 is missing, otherwise 3 would occur more than 3 times, there are no more multiples of 3 greater than 15;
p=5: a(4)=5, a(9)=15=3*5, a(13)=25=5*5, a(16)=35=5*7: no more multiples of 5 greater than 35;
p=7: a(6)=7, a(16)=35=5*7, a(21)=49=7*7, a(28)=77=7*11, a(32)=91=7*13, a(39)=119=7*17: no more multiples of 7 greater than 119.
- _Reinhard Zumkeller_, Feb 17 2013
		

Crossrefs

Cf. A020639, A008578, A005145, subsequence of A037143.

Programs

  • Haskell
    import Data.List (delete)
    a098962 n = a098962_list !! (n-1)
    a098962_list = 1 : f [2..] (tail a175944_list) where
       f xs'@(x:xs) ps'@(p:ps)
         | a010051 x == 1    = x : f xs (delete x ps')
         | u == q && v == q' = x : f xs' zs
         | otherwise         = f xs ps'
         where q = a020639 x; q' = div x q
               (us, u:us') = span (< q) ps'
               (vs, v:vs') = span (< q') us'
               zs@(z:_) = us ++ vs ++ vs'
               xs' = if z == p then xs else filter ((> 0) . (`mod` p)) xs
    -- Reinhard Zumkeller, Feb 17 2013

Formula

#{(n,k): A027746(a(n),k)=p, 1<=k<=A001222(a(n))} = p for all primes p. - Reinhard Zumkeller, Feb 17 2013

A339766 Decimal expansion of Sum_{n>=1} A054541(n)/A076954(n-1).

Original entry on oeis.org

2, 6, 1, 2, 0, 0, 0, 7, 4, 0, 4, 3, 4, 5, 2, 6, 0, 6, 4, 4, 3, 7, 3, 7, 1, 1, 3, 0, 9, 5, 4, 4, 5, 6, 7, 2, 4, 3, 3, 4, 0, 4, 5, 8, 7, 3, 7, 0, 9, 3, 8, 2, 6, 6, 0, 9, 3, 5, 1, 0, 8, 0, 6, 0, 5, 1, 5, 6, 0, 4, 1, 0, 8, 8, 7, 4, 9, 3, 0, 1, 3, 6, 2, 5, 1, 3, 6
Offset: 1

Views

Author

Davide Rotondo, Dec 16 2020

Keywords

Comments

With this constant f(1) and using the formula f(n+1) = (floor(f(n))*(f(n))) - ((floor(f(n)))^2 - floor(f(n))) it is possible to obtain the prime numbers repeated exactly a number of times corresponding to the position of the prime number. That is, 2 once, 3 twice, 5 thrice, etc.

Examples

			2.61200074043...
		

Crossrefs

Programs

  • Mathematica
    imax:=87;First[RealDigits[N[2+Sum[(Prime[i]-Prime[i-1])/Product[Prime[j-1]^(j-1),{j,2,i}],{i,2,imax}],imax]]] (* Stefano Spezia, Dec 16 2020 *)

Formula

Equals 2 + (3-2)/(2) + (5-3)/(2*3^2) + (7-5)/(2*3^2*5^3) + (11-7)/(2*3^2*5^3*7^4) + ...
Showing 1-7 of 7 results.