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-10 of 18 results. Next

A356208 a(n) is the number of occurrences of n in A133388.

Original entry on oeis.org

2, 3, 4, 4, 5, 7, 6, 8, 8, 9, 9, 10, 10, 12, 13, 12, 12, 15, 14, 17, 16, 16, 17, 18, 19, 18, 19, 20, 18, 24, 20, 22, 25, 22, 27, 26, 23, 25, 25, 29, 26, 30, 27, 31, 32, 32, 24, 33, 33, 34, 32, 32, 35, 37, 36, 37, 38, 32, 35, 44, 36, 41, 41, 40, 42, 45, 39, 43, 42
Offset: 1

Views

Author

Hugo Pfoertner, Sep 07 2022

Keywords

Crossrefs

Programs

  • Python
    from sympy.solvers.diophantine.diophantine import diop_DN
    def A356208(n): return sum(1 for m in range(1,(n**2<<1)+1) if n==max((a for a, b in diop_DN(-1,m)),default=0)) # Chai Wah Wu, Sep 08 2022

A356209 a(n) is the position of the latest occurrence of n in A133388.

Original entry on oeis.org

2, 8, 18, 32, 41, 72, 98, 128, 162, 181, 242, 288, 313, 392, 421, 512, 514, 648, 722, 761, 882, 968, 1058, 1152, 1201, 1301, 1458, 1568, 1466, 1741, 1922, 2048, 2178, 2056, 2381, 2592, 2594, 2888, 2817, 3121, 3202, 3528, 3698, 3872, 3789, 4232, 4418, 4608, 4802, 4804, 5101
Offset: 1

Views

Author

Hugo Pfoertner, Sep 07 2022

Keywords

Crossrefs

Programs

  • Python
    from sympy.solvers.diophantine.diophantine import diop_DN
    def A356209(n):
        for m in range(n**2<<1,0,-1):
            if n==max((a for a, b in diop_DN(-1,m)),default=0):
                return m # Chai Wah Wu, Sep 08 2022

Formula

a(k) = 2*k^2 for k not in A009003.

A000161 Number of partitions of n into 2 squares.

Original entry on oeis.org

1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 2, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 2, 1, 0, 0, 1, 0, 1, 0
Offset: 0

Views

Author

Keywords

Comments

Number of ways of writing n as a sum of 2 (possibly zero) squares when order does not matter.
Number of similar sublattices of square lattice with index n.
Let Pk = the number of partitions of n into k nonzero squares. Then we have A000161 = P0 + P1 + P2, A002635 = P0 + P1 + P2 + P3 + P4, A010052 = P1, A025426 = P2, A025427 = P3, A025428 = P4. - Charles R Greathouse IV, Mar 08 2010, amended by M. F. Hasler, Jan 25 2013
a(A022544(n))=0; a(A001481(n))>0; a(A125022(n))=1; a(A118882(n))>1. - Reinhard Zumkeller, Aug 16 2011

Examples

			25 = 3^2+4^2 = 5^2, so a(25) = 2.
		

References

  • J. V. Uspensky and M. A. Heaslet, Elementary Number Theory, McGraw-Hill, NY, 1939, p. 339

Crossrefs

Equivalent sequences for other numbers of squares: A010052 (1), A000164 (3), A002635 (4), A000174 (5).

Programs

  • Haskell
    a000161 n =
       sum $ map (a010052 . (n -)) $ takeWhile (<= n `div` 2) a000290_list
    a000161_list = map a000161 [0..]
    -- Reinhard Zumkeller, Aug 16 2011
    
  • Maple
    A000161 := proc(n) local i,j,ans; ans := 0; for i from 0 to n do for j from i to n do if i^2+j^2=n then ans := ans+1 fi od od; RETURN(ans); end; [ seq(A000161(i), i=0..50) ];
    A000161 := n -> nops( numtheory[sum2sqr](n) ); # M. F. Hasler, Nov 23 2007
  • Mathematica
    Length[PowersRepresentations[ #,2,2]] &/@Range[0,150] (* Ant King, Oct 05 2010 *)
  • PARI
    a(n)=sum(i=0,n,sum(j=0,i,if(i^2+j^2-n,0,1))) \\ for illustrative purpose
    
  • PARI
    A000161(n)=sum(k=sqrtint((n-1)\2)+1,sqrtint(n),issquare(n-k^2)) \\ Charles R Greathouse IV, Mar 21 2014, improves earlier code by M. F. Hasler, Nov 23 2007
    
  • PARI
    A000161(n)=#sum2sqr(n) \\ See A133388 for sum2sqr(). - M. F. Hasler, May 13 2018
    
  • Python
    from math import prod
    from sympy import factorint
    def A000161(n):
        f = factorint(n)
        return int(not any(e&1 for e in f.values())) + (((m:=prod(1 if p==2 else (e+1 if p&3==1 else (e+1)&1) for p, e in f.items()))+((((~n & n-1).bit_length()&1)<<1)-1 if m&1 else 0))>>1) if n else 1 # Chai Wah Wu, Sep 08 2022

Formula

a(n) = card { { a,b } c N | a^2+b^2 = n }. - M. F. Hasler, Nov 23 2007
Let f(n)= the number of divisors of n that are congruent to 1 modulo 4 minus the number of its divisors that are congruent to 3 modulo 4, and define delta(n) to be 1 if n is a perfect square and 0 otherwise. Then a(n)=1/2 (f(n)+delta(n)+delta(1/2 n)). - Ant King, Oct 05 2010

A136118 Least index m>0 such that A136117(n)-A000326(m) is again a pentagonal number.

Original entry on oeis.org

5, 4, 7, 12, 19, 17, 25, 20, 10, 28, 45, 42, 39, 17, 37, 21, 36, 35, 13, 33, 65, 28, 67, 32, 52, 40, 74, 31, 70, 85, 35, 16, 60, 70, 77, 68, 42, 30, 105, 76, 59, 26, 74, 49, 115, 19, 125, 115, 102, 110, 92, 56, 103, 29, 145, 100, 114, 77, 92, 47, 63, 108, 152, 95, 22, 116
Offset: 1

Views

Author

M. F. Hasler, Dec 25 2007

Keywords

Examples

			a(1)=5 is the least integer m>0 such that A136117(1)-P(m) is a pentagonal number, namely P(7)-P(5)=70-35=35=P(5).
a(2)=4 is the least integer m>0 such that A136117(2)-P(m) is a pentagonal number, namely P(8)-P(4)=92-22=70=P(7).
		

Crossrefs

Programs

  • PARI
    A136118vect(n,i=-1)=vector(n,k,until(0,for(j=2,#n=sum2sqr((i+=6)^2+1),n[j]%6==[5,5]||next;n=n[j];break(2)));n[1]\6+1) /* This uses sum2sqr(), cf. A133388. Below some simpler but much slower code. */
    my(P=A000326(n)=n*(3*n-1)/2,isPent(t)=P(sqrtint(t*2\3)+1)==t); for(i=1,299,for(j=1,(i+1)\sqrt(2),isPent(P(i)-P(j))&print1(j",")||next(2)))

A303374 Numbers of the form a^4 + b^6, with integers a, b > 0.

Original entry on oeis.org

2, 17, 65, 80, 82, 145, 257, 320, 626, 689, 730, 745, 810, 985, 1297, 1354, 1360, 2025, 2402, 2465, 3130, 4097, 4112, 4160, 4177, 4352, 4721, 4825, 5392, 6497, 6562, 6625, 7290, 8192, 10001, 10064, 10657, 10729, 14096, 14642, 14705, 15370, 15626, 15641, 15706, 15881
Offset: 1

Views

Author

M. F. Hasler, Apr 22 2018

Keywords

Comments

A subsequence of A000404 (a^2 + b^2), A055394 (a^2 + b^3), A111925 (a^4 + b^2), A100291 (a^4 + b^3), A303372 (a^2 + b^6).
Although it is easy to produce many terms of this sequence, it is nontrivial to check whether a very large number is of this form. Maybe the most efficient way is to consider decompositions of n into sums of two positive squares (see sum2sqr in A133388), and check if one of the terms is a third power and the other a fourth power.

Crossrefs

Cf. A055394 (a^2 + b^3), A111925 (a^2 + b^4), A100291 (a^4 + b^3), A100292 (a^5 + b^2), A100293 (a^5 + b^3), A100294 (a^5 + b^4).
Cf. A303372 (a^2 + b^6), A303373 (a^3 + b^6), A303375 (a^5 + b^6).

Programs

  • Mathematica
    Take[Flatten[Table[a^4+b^6,{a,20},{b,20}]]//Union,50] (* Harvey P. Dale, Jul 17 2025 *)
  • PARI
    is(n,k=4,m=6)=for(b=1,sqrtnint(n-1,m),ispower(n-b^m,k)&&return(b)) \\ Returns b > 0 if n is in the sequence, else 0.
    is(n,L=sum2sqr(n))={for(i=1,#L,L[i][1]&&for(j=1,2,ispower(L[i][j],3)&&issquare(L[i][3-j])&&return(L[i][j])))} \\ See A133388 for sum2sqr(). Much faster than the above for n >> 10^30.
    A303374(L=10^5,k=4,m=6,S=[])={for(a=1,sqrtnint(L-1,m),for(b=1,sqrtnint(L-a^m,k),S=setunion(S,[a^m+b^k])));S}

A136117 Pentagonal numbers (A000326) which are the sum of 2 other positive pentagonal numbers.

Original entry on oeis.org

70, 92, 852, 925, 1247, 1426, 1926, 2625, 3577, 5192, 6305, 6501, 7107, 7740, 7957, 8177, 8626, 9560, 10292, 12927, 13207, 14652, 15555, 16172, 18095, 20475, 20827, 21901, 22265, 22632, 23002, 23751, 24130, 28497, 29330, 31032, 33227, 33675
Offset: 1

Views

Author

M. F. Hasler, Dec 15 2007; corrected Dec 25 2007

Keywords

Comments

It is conjectured that every integer and hence every pentagonal number, greater than 33066, hence greater than A000326(149) = 33227, can be represented as the sum of three pentagonal numbers. - Jonathan Vos Post, Dec 18 2007

Examples

			a(1)=70=P(7) is the least pentagonal number which can be written as sum of two other pentagonal numbers, P(7)=P(5)+P(5).
		

Crossrefs

Programs

  • PARI
    P(n)=n*(3*n-1)>>1 /* a.k.a. A000326 */
    isPent(t)=P(sqrtint(t<<1\3)+1)==t
    for(i=1,299,for(j=1,(i+1)\sqrt(2),isPent(P(i)-P(j)) && print1(P(i)",") || next(2)))
    /* The following is much faster, at the cost of implementing sum2sqr(), cf. A133388*/
    A136117next(i)=i=sqrtint(i\3*2)*6+5; until(0, for(j=2,#t=sum2sqr((i+=6)^2+1), t[j]%6==[5,5] && break(2)));i^2\24
    A136117vect(n,i)=vector(n,j,i=A136117next(i)) /* 2nd arg =0 by default but allows one to start elsewhere */
    A136117(n,i)=until(!n--,i=A136117next(i));i \\ M. F. Hasler, Dec 25 2007

Formula

a(n) = A000326(A136116(n)) = A000326(m)+A136114(m) where m is the index of the n-th nonzero term in A136114 or A136115.

A304433 Numbers n such that n^3 is the sum of two distinct perfect powers > 1 (x^k + y^m; x, y, k, m >= 2).

Original entry on oeis.org

5, 7, 8, 10, 12, 13, 14, 17, 20, 25, 26, 28, 29, 32, 33, 34, 37, 40, 41, 45, 48, 50, 52, 53, 56, 57, 58, 61, 63, 65, 68, 71, 72, 73, 74, 78, 80, 82, 85, 89, 90, 97, 98, 100, 101, 104, 105, 106, 109, 112, 113, 114, 116, 117, 122, 125, 126, 128
Offset: 1

Views

Author

M. F. Hasler, May 12 2018

Keywords

Comments

Motivated by the search of solutions to a^n + b^(2n+2)/4 = (perfect square), which arises when searching solutions to x^n + y^(n+1) = z^(n+2) of the form x = a*z, y = b*z. It turns out that many solutions are of the form a^n = d (b^(n+1) + d), where d is a perfect power.

Examples

			5^3 = 125 = 4^2 + 11^2; 7^3 = 10^2 + 3^5; 8^3 = 13^2 + 7^3, ...
		

Crossrefs

Cf. A001597 (perfect powers), A076467 (cubes and higher powers), A304434, A304435, A304436 (analog for n^4, n^5, n^6).

Programs

  • Maple
    N:= 200: # to get terms <= N
    N3:= N^3:
    P:= {seq(seq(x^k, k=3..floor(log[x](N3))), x=2..N)}:
    filter:= proc(n) local n3, Pp, x, y;
      n3:= n^3;
      if remove(t -> subs(t, x)<=1 or subs(t, y)<=1 or subs(t, x-y)=0, [isolve(x^2+y^2=n3)]) <> [] then return true fi;
      Pp:= map(t ->n3-t, P minus {n3, n3/2});
       (Pp intersect P <> {}) or (select(issqr, Pp) <> {})
    end proc:
    select(filter, [$2..N]); # Robert Israel, Jun 01 2018
  • Mathematica
    M = 200;
    M3 = M^3;
    P = Union@ Flatten@ Table[Table[x^k, {k, 3, Floor[Log[x, M3]]}], {x, 2, M}];
    filterQ[n_] := Module[{n3, Pp, x, y}, n3 = n^3; If[Solve[x > 1 && y > 1 && x != y && x^2 + y^2 == n3, {x, y}, Integers] != {}, Return[True]]; Pp = n3 - (P ~Complement~ {n3, n3/2}); (Pp ~Intersection~ P) != {} || Select[ Pp, IntegerQ[Sqrt[#]]&] != {}];
    Select[Range[2, M], filterQ] (* Jean-François Alcover, Jun 21 2020, after Robert Israel *)
  • PARI
    L=200^3; P=List(); for(x=2, sqrtnint(L,3), for(k=3, logint(L, x), listput(P, x^k))); #P=Set(P) \\ This P = A076467 \ {1} = A111231 \ {0} up to limit L.
    is(n,e=3)={for(i=1, #s=sum2sqr(n=n^e), vecmin(s[i])>1 && s[i][1]!=s[i][2] && return(1)); for(i=1, #P, n>P[i]||return; ispower(n-P[i])&& P[i]*2 != n && return(1))} \\ The above P must be computed up to L >= n^3. For sum2sqr() see A133388.

A304434 Numbers n such that n^4 is the sum of two distinct perfect powers > 1 (x^k + y^m; x, y, k, m >= 2).

Original entry on oeis.org

3, 5, 6, 9, 10, 12, 13, 14, 15, 17, 20, 24, 25, 26, 28, 29, 30, 34, 35, 36, 37, 39, 40, 41, 42, 45, 48, 50, 51, 52, 53, 55, 57, 58, 60, 61, 63, 65, 68, 70, 71, 72, 73, 74, 75, 78, 80, 82, 85, 87, 89, 90, 91, 95, 96, 97, 98, 100, 101, 102, 104, 105, 106, 109, 110, 111, 113
Offset: 1

Views

Author

M. F. Hasler, May 22 2018

Keywords

Comments

Motivated by the search of solutions to a^n + b^(2n+2)/4 = (perfect square), which arises when searching solutions to x^n + y^(n+1) = z^(n+2) of the form x = a*z, y = b*z. It turns out that many solutions are of the form a^n = d (b^(n+1) + d), where d is a perfect power.

Examples

			3^4 = 2^5 + 7^2; 5^4 = 7^2 + 24^2, ...
		

Crossrefs

Cf. A304433, A001597 (perfect powers), A076467 (third or higher powers).

Programs

  • Maple
    N:= 200: # to get terms <= N
    N4:= N^4:
    P:= {seq(seq(x^k,k=3..floor(log[x](N4))),x=2..floor(N4^(1/3)))}:
    filter:= proc(n) local n4, Pp;
      n4:= n^4;
      if remove(t -> subs(t,x)<=1 or subs(t,y)<=1 or subs(t,x-y)=0, [isolve(x^2+y^2=n4)]) <> [] then return true fi;
      Pp:= map(t ->n4-t, P minus {n4, n4/2});
      (Pp intersect P <> {}) or (select(issqr,Pp) <> {})
    end proc:
    A:= select(filter, [$2..N]); # Robert Israel, May 24 2018
  • PARI
    L=200^4; P=List(); for(x=2, sqrtnint(L,3), for(k=3, logint(L, x), listput(P, x^k))); #P=Set(P) \\ This P = A076467 \ {1} = A111231 \ {0} up to limit L.
    is_A304434(n)={for(i=1, #s=sum2sqr(n=n^4), vecmin(s[i])>1 && s[i][1]!=s[i][2] && return(1)); for(i=1, #P, n>P[i]||return; ispower(n-P[i])&& P[i]*2 != n && return(1))} \\ The above P must be computed up to L >= n^4. For sum2sqr() see A133388.

A136116 Indices of pentagonal numbers (A000326) which are the sum of 2 other positive pentagonal numbers.

Original entry on oeis.org

7, 8, 24, 25, 29, 31, 36, 42, 49, 59, 65, 66, 69, 72, 73, 74, 76, 80, 83, 93, 94, 99, 102, 104, 110, 117, 118, 121, 122, 123, 124, 126, 127, 138, 140, 144, 149, 150, 152, 161, 163, 168, 169, 174, 175, 178, 181, 185, 188, 190, 195, 199, 203, 209, 210, 212, 213
Offset: 1

Views

Author

M. F. Hasler, Dec 15 2007; corrected Dec 25 2007

Keywords

Examples

			a(1)=7 since P(7)=70 is the least pentagonal number which can be written as sum of two other pentagonal numbers, P(7)=P(5)+P(5).
		

Crossrefs

Programs

  • PARI
    P(n)=n*(3*n-1)>>1 /* a.k.a. A000326 */
    isPent(t)=P(sqrtint(t<<1\3)+1)==t
    for(i=1,999,for(j=1,(i+1)\sqrt(2),isPent(P(i)-P(j))&print1(i",") || next(2)))
    /* The following are much faster, at the cost of implementing sum2sqr(), cf. A133388. */
    A136116next(i)=i=6*i-1;until(0,for(j=2,#t=sum2sqr((i+=6)^2+1),t[j]%6==[5,5] && break(2))); i\6+1
    A136116vect(n,i=0)=vector(n,j,i=A136116next(i))
    A136116(n,i=0)=until(!n--,i=A136116next(i));i \\ M. F. Hasler, Dec 25 2007

Formula

A000326(a(n))=A000326(m)+A136114(m) where m is the index of the n-th nonzero term in A136114 or A136115.

A226539 Numbers which are the sum of two squared primes in exactly two ways (ignoring order).

Original entry on oeis.org

338, 410, 578, 650, 890, 1010, 1130, 1490, 1730, 1802, 1898, 1970, 2330, 2378, 2738, 3050, 3170, 3530, 3650, 3842, 3890, 4010, 4658, 4850, 5018, 5090, 5162, 5402, 5450, 5570, 5618, 5690, 5858, 6170, 6410, 6530, 6698, 7010, 7178, 7202, 7250, 7850, 7970, 8090
Offset: 1

Views

Author

Henk Koppelaar, Jun 10 2013

Keywords

Examples

			338 = 7^2 + 17^2 = 13^2 + 13^2;
410 = 7^2 + 19^2 = 11^2 + 17^2.
		

References

  • Stan Wagon, Mathematica in Action, Springer, 2000 (2nd ed.), Ch. 17.5, pp. 375-378.

Crossrefs

Cf. A054735 (restricted to twin primes), A037073, A069496.
Cf. A045636 (sum of two squared primes: a superset).
Cf. A214511 (least number having n representations).
Cf. A226562 (restricted to sums decomposed in exactly three ways).

Programs

  • Maple
    Prime2PairsSum := p -> select(x ->`if`(andmap(isprime, x),true,false), numtheory:-sum2sqr(p)):
    for n from 2 to 10^6 do
      if nops(Prime2PairsSum(n)) = 2 then print(n, Prime2PairsSum(n)) fi;
    od;
  • Mathematica
    Select[Range@10000, Length[Select[ PowersRepresentations[#, 2, 2], And @@ PrimeQ[#] &]] == 2 &] (* Giovanni Resta, Jun 11 2013 *)
  • PARI
    select( is_A226539(n)={#[0|t<-sum2sqr(n),isprime(t[1])&&isprime(t[2])]==2}, [1..10^4]) \\ For more efficiency, apply selection to A045636. See A133388 for sum2sqr(). - M. F. Hasler, Dec 12 2019

Extensions

a(25)-a(44) from Giovanni Resta, Jun 11 2013
Showing 1-10 of 18 results. Next