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.

A124865 Numbers of the form p^2-q^2 with p > q prime.

Original entry on oeis.org

5, 16, 21, 24, 40, 45, 48, 72, 96, 112, 117, 120, 144, 160, 165, 168, 192, 240, 264, 280, 285, 288, 312, 336, 352, 357, 360, 408, 432, 480, 504, 520, 525, 528, 552, 600, 648, 672, 720, 768, 792, 816, 832, 837, 840, 888, 912, 936, 952, 957, 960, 1008, 1032, 1080
Offset: 1

Views

Author

Alexander Adamchuk, Nov 10 2006

Keywords

Comments

The only prime term is a(1) = 5.
All odd terms are of the form p^2-4.
All even terms are divisible by 8.
Numbers of the form (p^2-q^2)/8 (p, q odd primes, p>q) are listed in A124866.
Elliott & Richner call these "ans numbers". - Charles R Greathouse IV, Feb 17 2014

Crossrefs

Apart from a(1), a subsequence of A177713.
Cf. A045636 (numbers of the form p^2+q^2, p, q primes).
Cf. A124866 (numbers of the form (p^2-q^2)/8, p, q odd primes, p>q).

Programs

  • Mathematica
    With[{nn=60},Take[Union[#[[2]]^2-#[[1]]^2&/@Subsets[Prime[Range[nn]],{2}]],nn]] (* Harvey P. Dale, Aug 21 2015 *)
  • PARI
    is(n)=if(n%24, isprimepower(n+4)==2 || isprimepower(n+9)==2, fordiv(n/4,d, if(isprime(n/d/4+d) && isprime(n/d/4-d), return(1))); 0) \\ Charles R Greathouse IV, Feb 17 2014

Formula

a(n) >> n log n, see Luca. - Charles R Greathouse IV, Feb 17 2014

A177731 Numbers which can be written as a sum of consecutive numbers, where the largest term in the sum is an odd number >= 3.

Original entry on oeis.org

5, 6, 9, 12, 13, 14, 15, 17, 18, 21, 22, 24, 25, 27, 28, 29, 30, 33, 35, 36, 37, 38, 39, 41, 42, 44, 45, 46, 48, 49, 51, 53, 54, 55, 56, 57, 60, 61, 62, 63, 65, 66, 69, 70, 72, 73, 75, 76, 77, 78, 81, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102
Offset: 1

Views

Author

Keywords

Comments

Numbers of the form sum_{i=j..2k+1} i where j>=1 and 2k+1>j and k>=1. Numbers of the form (2k+1+j)*(2k+2-j)/2, j>=1, k>=1, 2k+1>j. - R. J. Mathar, Dec 04 2011
Subsequences include the A000384 where >=6, the A014106 where >=5, A071355 where >=12, A130861 where >=9, A139577 where >=13, A139579 where >=17 etc. The sequence is the union of all odd-indexed rows of A141419, except its first column and numbers <=3: {5,6}, {9,12,14,15}, {13,18,22,25,27,28}, ... - R. J. Mathar, Dec 04 2011
Does this sequence have asymptotic density 1? - Robert Israel, Nov 27 2018

Examples

			5=2+3, 6=1+2+3, 9=4+5, 12=3+4+5,...
		

Crossrefs

Contains A004766, A017137 and nonzero terms of A008588.
Disjoint from A002145.
Subsequence of A138591.

Programs

  • Maple
    f:= proc(n) local r,k;
      for r in select(t -> (2*t-1)^2 >= 1+8*n, numtheory:-divisors(2*n) minus {2*n}) do
        k:= (r + 2*n/r - 3)/4;
        if k::posint and r >= 2*k+2 then return true fi
      od:
      false
    end proc:
    select(f, [$1..1000]); # Robert Israel, Nov 27 2018
  • Mathematica
    z=200;lst1={};Do[c=a;Do[c+=b;If[c<=2*z,AppendTo[lst1,c]],{b,a-1,1,-1}],{a,1,z,2}];Union@lst1

A177732 The sums of two or more consecutive positive numbers, the largest being even.

Original entry on oeis.org

3, 7, 9, 10, 11, 15, 18, 19, 20, 21, 23, 26, 27, 30, 31, 33, 34, 35, 36, 39, 40, 42, 43, 45, 47, 49, 50, 51, 52, 54, 55, 57, 58, 59, 60, 63, 66, 67, 68, 69, 70, 71, 72, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 87, 90, 91, 93, 95, 98, 99, 100, 102, 103, 104, 105, 106, 107, 108
Offset: 1

Views

Author

Keywords

Comments

Numbers of the form (j+2l)*(2l-j+1)/2 with j>=1 and 2l>j. Subsequences are A014105 where >=3, (j=1), A014107 where >=9 (j=2). - R. J. Mathar, Jul 14 2012

Examples

			3=1+2, 7=3+4, 9=2+3+4, 10=1+2+3+4, 11=5+6,..
		

Crossrefs

Programs

  • Mathematica
    z=200;lst2={};Do[c=a;Do[c+=b;If[c<=2*z,AppendTo[lst2,c]],{b,a-1,1,-1}],{a,2,z,2}];Union@lst2
    With[{upto=108},Select[Union[Flatten[Table[Accumulate[Range[2n-1,1,-1]]+ 2n,{n,upto/4}]]],#<=upto&]] (* Harvey P. Dale, May 19 2019 *)

A177733 Integers that can be expressed as the sum of two or more positive consecutive numbers (the largest being even) AND also as the sum of two or more positive consecutive numbers (the largest being odd).

Original entry on oeis.org

9, 15, 18, 21, 27, 30, 33, 35, 36, 39, 42, 45, 49, 51, 54, 55, 57, 60, 63, 66, 69, 70, 72, 75, 77, 78, 81, 84, 87, 90, 91, 93, 95, 98, 99, 102, 105, 108, 110, 111, 114, 115, 117, 119, 120, 121, 123, 126, 129, 132, 133, 135, 138, 140, 141, 143, 144, 147, 150, 153, 154
Offset: 1

Views

Author

Keywords

Comments

Intersection of A177732 and A177731.
From Robert Israel, May 02 2023: (Start)
Numbers k with odd divisors d_1, d_2 >= 2 such that k + (d_1+1)/2 is odd and
k + (d_2+1)/2 is even.
Contains no primes, powers of 2 or products of a prime and a power of 2.
Contains odd semiprime p*q iff at least one of p and q == 3 (mod 4).
(End)

Examples

			9 is in the sequence because 2+3+4=9=4+5.
15 is in the sequence because 7+8=15=1+2+3+4+5.
		

Crossrefs

Programs

  • Maple
    filter:= proc(n) local a,b,x,y,todd,teven;
       todd:= false; teven:= false;
       for a in select(type,numtheory:-divisors(n),odd) minus {1} do
         b:= 2*n/a;
         x:= (a+b+1)/2;
           if x::odd then todd:= true; if teven then return true fi
           else teven:= true; if todd then return true fi
         fi od:
      false
    end proc:
    select(filter, [$1..200]); # Robert Israel, May 01 2023
  • Mathematica
    z=200;lst1={};Do[c=a;Do[c+=b;If[c<=2*z,AppendTo[lst1,c]],{b,a-1,1,-1}],{a,1,z,2}];Union@lst1; z=200;lst2={};Do[c=a;Do[c+=b;If[c<=2*z,AppendTo[lst2,c]],{b,a-1,1,-1}],{a,2,z,2}]; Intersection[lst1,lst2]

A357928 a(n) is the smallest c for which (s+c)^2-n is a square, where s = floor(sqrt(n)), or -1 if no such c exists.

Original entry on oeis.org

0, 0, -1, 1, 0, 1, -1, 2, 1, 0, -1, 3, 1, 4, -1, 1, 0, 5, -1, 6, 2, 1, -1, 8, 1, 0, -1, 1, 3, 10, -1, 11, 1, 2, -1, 1, 0, 13, -1, 2, 1, 15, -1, 16, 6, 1, -1, 18, 1, 0, -1, 3, 7, 20, -1, 1, 2, 4, -1, 23, 1, 24, -1, 1, 0, 1, -1, 26, 10, 5, -1, 28, 1, 29, -1, 2, 12, 1, -1, 32
Offset: 0

Views

Author

Darío Clavijo, Oct 20 2022

Keywords

Comments

c exists iff n != 2 (mod 4), and it allows n to be written as the difference of two perfect squares.
This gives a factorization n = x*y where x and y may or may not be primes: let s = floor(sqrt(n)), u = a(n) + s and v = u^2 - n; then w = sqrt(v), x = u - w, y = u + w and x*y == n.
The Fermat factorization algorithm seeks such a form, starting from s, so that a(n) is the number of steps it must take for n != 2 (mod 4).
a(n) >= 1 if n is not square and is writable as a difference of squares.
a(n) = 0 if n is square.
a(n) = -1 if n is not writable as a difference of squares.

Examples

			n   prime  square  n == 2 (mod 4)   c   s  v=(s+c)^2-n   u   w   x   y  x*y
--  -----  ------  --------------  --  --  -----------  --  --  --  --  ---
76      F       F               F  12   8          324  20  68   2  38   76
13      T       F               F   4   3           36   7   6   1  13   13
25      F       T               F   0   0            0   5   0   5   5   25
7       T       F               T  -1   -            -   -   -   -   -    -
		

Crossrefs

Programs

  • PARI
    a(n) = if ((n%4)==2, -1, my(s=sqrtint(n), c=0); while (!issquare((s+c)^2-n), c++); c); \\ Michel Marcus, Oct 24 2022
  • Python
    from gmpy2 import *
    def fermat(n):
        a, rem = isqrt_rem(n)
        b2 = -rem
        c0 = (a << 1) + 1
        c = c0
        while not is_square(b2):
            b2 += c
            c += 2
        return (c-c0) >> 1
    def A357928(n):
      if is_square(n):
          return 0
      elif ((n-2) % 4) != 0:
          return fermat(n)
      else:
          return -1
    
  • Python
    from math import isqrt
    from itertools import takewhile
    from sympy import divisors
    def A357928(n): return -1 if n&3==2 else min((m>>1 for d in takewhile(lambda d:d**2<=n,divisors(n)) if not((m:=n//d+d) & 1)),default=0) - isqrt(n) # Chai Wah Wu, Oct 26 2022
    

A357945 Numbers k which are not square but D = (b+c)^2 - k is square, where b = floor(sqrt(k)) and c = k - b^2.

Original entry on oeis.org

5, 13, 28, 65, 69, 76, 125, 128, 189, 205, 300, 305, 325, 352, 413, 425, 532, 533, 544, 565, 693, 725, 793, 828, 860, 1025, 1036, 1045, 1105, 1141, 1248, 1449, 1469, 1504, 1525, 1708, 1885, 1917, 1965, 2125, 2240, 2353, 2380, 2501, 2533, 2548, 2812, 2816, 2825, 2829, 2844, 2873, 2893
Offset: 1

Views

Author

Darío Clavijo, Oct 21 2022

Keywords

Comments

All composite terms are included in A177713.
Terms are the difference of two perfect squares k = (b+c)^2 - d^2, where d = sqrt(D), and so if composite are factorizable by Fermat's method k = ((b+c) + d) * ((b+c) - d).

Examples

			8525 is a term since it's not square and b = floor(sqrt(k)) = 92 and c = k - b^2 = 61 gives D = (b+c)^2 - k = 14884 which is square (122^2).
		

Crossrefs

Subsequence of A042965 and of A000037.
A211412 is a subsequence.

Programs

  • PARI
    isok(k) = if (!issquare(k), my(b=sqrtint(k), c=k-b^2); issquare((b+c)^2 - k)); \\ Michel Marcus, Oct 23 2022
  • Python
    from gmpy2 import *
    def is_A357945(n):
      if not is_square(n):
        b,c = isqrt_rem(n)
        return is_square(c*(2*b+c-1))
      else:
        return False
    

Formula

1.6*n < a(n) <= 4n^4 + 1. (Improvements welcome!) - Charles R Greathouse IV, Oct 23 2022
Showing 1-6 of 6 results.