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

A075556 Smallest prime p not occurring earlier such that p+n is a square, or 0 if no such p exists.

Original entry on oeis.org

3, 2, 13, 5, 11, 19, 29, 17, 7, 71, 53, 37, 23, 67, 181, 0, 47, 31, 557, 61, 43, 59, 41, 97, 0, 199, 73, 197, 167, 139, 113, 89, 163, 191, 109, 0, 107, 83, 157, 401, 103, 79, 101, 317, 151, 179, 149, 241, 0, 239, 349, 173, 271, 307, 269, 233, 619, 383, 137, 229
Offset: 1

Views

Author

Amarnath Murthy, Sep 23 2002

Keywords

Comments

a(n)=0 or 2*sqrt(n)+1 for square n. Apparently the only cases where it is 2*sqrt(n)+1 are n=1, 4 and 9. - Ralf Stephan, Mar 30 2003, corrected by Robert Israel, Dec 07 2024

Crossrefs

Programs

  • Maple
    for n from 1 to 100 do
      if issqr(n) then
        r:= sqrt(n);
        if isprime(2*r+1) and not assigned(S[2*r+1]) then R[n]:= 2*r+1; S[2*r+1]:= n else R[n] := 0 fi;
      else
        for k from ceil(sqrt(n)) do
          if not assigned(S[k^2-n]) and isprime(k^2-n) then R[n]:= k^2-n; S[k^2-n]:= n; break fi;
        od
      fi;
    od:
    seq(R[i],i=1..100); # Robert Israel, Dec 06 2024
  • PARI
    v=vector(1000000); for(n=1, 100, f=0; forprime(p=2, 1000000, if(!v[p]&&issquare(p+n), f=p; break)); if(f, print1(f", "); v[f]=1, print1("0, ")));

Extensions

More terms from Ralf Stephan, Mar 30 2003

A105016 Smallest a(n) such that a(n)^2 - n is a positive prime, or 0 if no such a(n) exists.

Original entry on oeis.org

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

Views

Author

Joshua Zucker, Mar 31 2005

Keywords

Comments

An old ARML problem asked for the smallest n>0 such that a(n) does not exist.

Examples

			a(8) = 5 because 5^2 - 8 = 17 is the smallest square that gives a prime difference.
a(16) = 0 because if x^2 - 16 is prime, then a prime equals (x+4)(x-4), which is impossible.
		

Crossrefs

Cf. A075555 for the primes = a(n)^2 - n.

Programs

  • Mathematica
    Table[s = Sqrt[n]; If[IntegerQ[s], If[PrimeQ[(s + 1)^2 - n], k = s + 1, k = 0], k = Ceiling[s]; While[! PrimeQ[k^2 - n], k++]]; k, {n, 0, 100}] (* T. D. Noe, Apr 17 2011 *)
Showing 1-3 of 3 results.