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

A080883 Distance of n to next square.

Original entry on oeis.org

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

Views

Author

Ralf Stephan, Mar 29 2003

Keywords

Comments

The following sequences all have the same parity: A004737, A006590, A027052, A071028, A071797, A078358, A078446, A080883. - Jeremy Gardiner, Dec 30 2006

Crossrefs

Cf. A075555.
Cf. A066635, A053188. - R. J. Mathar, Aug 08 2009

Programs

  • GAP
    List([0..90], n-> Int(1+RootInt(n))^2 -n); # G. C. Greubel, Nov 07 2019
  • Magma
    [Floor(1+Sqrt(n))^2 -n: n in [0..90]]; // G. C. Greubel, Nov 07 2019
    
  • Maple
    A080883 := proc(n) (floor(sqrt(n)+1))^2 -n ; end: seq( A080883(n),n=0..40) ; # R. J. Mathar, Aug 08 2009
  • Mathematica
    Table[Floor[1+Sqrt[n]]^2 -n, {n,0,90}] (* G. C. Greubel, Nov 07 2019 *)
  • PARI
    a(n) = (sqrtint(n)+1)^2-n; \\ Michel Marcus, May 22 2024
    
  • Sage
    [floor(1+sqrt(n))^2 -n for n in (0..90)] # G. C. Greubel, Nov 07 2019
    

Formula

a(n) = floor( sqrt(n)+1 )^2 - n.

A163492 Numbers such that the two adjacent integers are a perfect square and a prime.

Original entry on oeis.org

1, 2, 3, 8, 10, 24, 48, 80, 82, 168, 224, 226, 360, 440, 442, 728, 840, 1088, 1090, 1224, 1368, 1522, 1848, 2026, 2208, 2400, 3024, 3250, 3720, 3968, 4760, 5040, 5624, 5928, 6562, 7920, 8648, 9802, 10608, 11026, 11448, 12322, 13688, 13690, 14160, 14640
Offset: 1

Views

Author

Gaurav Kumar, Jul 29 2009

Keywords

Comments

Also known as the Beprisque numbers.

Examples

			a(1) = 2 since 2 lies between 1(square) and 3(prime).
a(2) = 3 since 3 lies between 2(prime) and 4(square).
		

Crossrefs

Programs

  • Mathematica
    nn = 100; Sort[Select[Range[0, nn], PrimeQ[#^2 + 2] &]^2 + 1, Select[Range[nn], PrimeQ[#^2 - 2] &]^2 - 1] (* T. D. Noe, Aug 29 2012 *)
    Select[Range[15000],AnyTrue[#+{1,-1},PrimeQ]&&AnyTrue[{Sqrt[#-1],Sqrt[ #+1]},IntegerQ]&] (* Harvey P. Dale, Feb 06 2023 *)

Extensions

Definition clarified by R. J. Mathar, Aug 08 2009
Number 1 added by WG Zeist, Aug 28 2012

A154840 Distance to nearest cube different from n.

Original entry on oeis.org

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

Views

Author

R. J. Mathar, Nov 01 2009

Keywords

Comments

Equals A074989(n) if this is not zero, else 1+A055400(n-1), the distance to the nearest cube < n.

Examples

			a(8)=7, because the two cubes below and above 8 are 1^3=1 and 3^3=27, and the distance to 1 is smaller, namely 8-1=7.
		

Crossrefs

Programs

  • Maple
    distNearstDiffCub := proc(n) local iscbr ; iroot(n,3,'iscbr') ; if iscbr then 1+A055400(n-1); else A074989(n) ; end if; end proc;
  • Mathematica
    dnc[n_]:=Module[{c=Surd[n,3]},If[IntegerQ[c],n-(c-1)^3,Min[n-Floor[ c]^3, Ceiling[c]^3-n]]]; Array[dnc,90,0] (* Harvey P. Dale, Mar 30 2019 *)

A289642 Number of 2-digit numbers whose digits add up to n.

Original entry on oeis.org

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

Views

Author

Miquel Cerda, Jul 09 2017

Keywords

Comments

The 2-digit numbers distributed according to the sum of their digits n.
Symmetrical sequence; a(n) = a(19 - n).

Examples

			n(5) = 5 because there are 5 numbers whose digits sum = 5 (14, 23, 32, 41, 50).
		

Crossrefs

Cf. A071817 (3-digit numbers), A090579 (4-digit numbers), A090580 (5-digit numbers), A090581 (6-digit numbers), A278969 (7-digit numbers), A278971 (8-digit numbers), A289354 (9-digit numbers), A053188, A074989, A004739, A066635, A154840, A249121.

Formula

G.f.: (1 - x^10)*(x - x^10)/(1 - x)^2.
a(n) = (19-abs(n-9)-abs(n-10))/2 for n=1..18. - Wesley Ivan Hurt, Jul 09 2017

A309914 Distance from n to closest triangular number that is different from n.

Original entry on oeis.org

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

Views

Author

Ilya Gutkovskiy, Aug 22 2019

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{k = 1}, While[! IntegerQ[Sqrt[8 (n + k) + 1]] && ! IntegerQ[Sqrt[8 (n - k) + 1]], k++]; k]; Table[a[n], {n, 0, 100}]
Showing 1-5 of 5 results.