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.

Previous Showing 21-27 of 27 results.

A145172 Number of pentagonal numbers needed to represent n with greedy algorithm.

Original entry on oeis.org

1, 2, 3, 4, 1, 2, 3, 4, 5, 2, 3, 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, 4, 2, 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, 4, 2, 3, 4, 5, 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, 4, 2, 3, 4, 5, 6, 3, 4, 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, 4, 2, 3, 4, 5, 6, 3, 4, 5, 6
Offset: 1

Views

Author

Christina Steffan (christina.steffan(AT)gmx.at), Oct 03 2008

Keywords

Comments

Sequence is unbounded.

Examples

			a(21)=6 since 21 = 12+5+1+1+1+1.
		

Crossrefs

Cf. A000326 (pentagonal numbers), A053610, A057945, A180447, A192988.

Programs

  • PARI
    a(n)={my(s=0); forstep(k=(sqrtint(24*n+1)+1)\6, 1, -1, my(t=k*(3*k-1)/2); s+=n\t; n%=t); s} \\ Andrew Howroyd, Apr 21 2021

Extensions

Terms a(41) and beyond from Andrew Howroyd, Apr 21 2021

A174806 a(n) = n-floor(sqrt(n))^2-floor(sqrt(n-floor(sqrt(n))^2))^2; difference between n and sum of two largest distinct squares <= n.

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 1, 2, 0, 0, 0, 1, 2, 0, 1, 2, 0, 0, 1, 2, 0, 1, 2, 3, 4, 0, 0, 1, 2, 0, 1, 2, 3, 4, 0, 1, 0, 0, 1, 2, 0, 1, 2, 3, 4, 0, 1, 2, 3, 0, 0, 1, 2, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 0, 0, 1, 2, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 0, 0, 0, 1, 2, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 0, 0, 1, 2, 0
Offset: 0

Views

Author

Keywords

Comments

If a(n)=0 then n is a sum of two squares A001481, but not conversely. For the sum of two squares n = 18, 32, 41, ... we have a(n) > 0. - Thomas Ordowski, Jul 11 2014

Examples

			24=4^2+8;8-2^2=4, 115=10^2+15;15-3^2=6,..
		

Crossrefs

Programs

  • Mathematica
    a[n_]:=n-Floor[Sqrt[n]]^2-Floor[Sqrt[n-Floor[Sqrt[n]]^2]]^2;
    Table[a[n], {n,0,6!}]
  • PARI
    a(n) = my(x=sqrtint(n)^2); n - x - sqrtint((n-x))^2; \\ Michel Marcus, Dec 17 2022

Formula

a(n) = 0 iff A053610(n) < 3 and 0 < a(n) = m^2 iff A053610(n) = 3. - Thomas Ordowski, Jul 12 2014

A245440 Primes p == 1 (mod 4) such that p - floor(sqrt(p))^2 and 2p - floor(sqrt(2p))^2 are not squares.

Original entry on oeis.org

353, 373, 449, 461, 521, 541, 593, 653, 673, 757, 769, 797, 821, 829, 941, 953, 1009, 1021, 1061, 1069, 1097, 1193, 1217, 1237, 1249, 1277, 1361, 1381, 1481, 1489, 1549, 1597, 1613, 1621, 1657, 1669, 1693, 1709, 1721, 1733, 1777, 1801, 1877, 1889, 1933, 1949
Offset: 1

Views

Author

Thomas Ordowski, Jul 22 2014

Keywords

Comments

Primes p of the form 4k+1 such that A053610(p) > 2 and A053610(2p) > 2.
Note that p = a^2 + b^2 and 2p = (a+b)^2 + (a-b)^2 is the only way. So according to the definition the greedy algorithm cannot give such the sums of two squares.
Interesting fact: a(n) = A145023(n) for all n < 25. Of course A145023 is a subsequence.
Primes p == 1 (mod 4) such that A245474(p) > 2.

Crossrefs

Programs

  • Magma
    [p: p in PrimesUpTo(10000) | p mod 4 eq 1 and not IsSquare(p-Floor(Sqrt(p))^2) and not IsSquare(2*p-Floor(Sqrt(2*p))^2)]; // Vincenzo Librandi, Sep 19 2017
  • Mathematica
    a245440Q[n_Integer] := If[
      And[PrimeQ[n] == True, Mod[n, 4] == 1],
      If[Or[IntegerQ[Sqrt[n - Floor[Sqrt[n]]^2]] == True,
        IntegerQ[Sqrt[2*n - Floor[Sqrt[2*n]]^2]] == True], False, True],
      False]; a245440[n_Integer] :=
    Flatten[Position[Thread[a245440Q[Range[n]]],
       True]]; a245440[300000]; (* Michael De Vlieger, Aug 05 2014 *)
  • PARI
    s=[]; forprime(p=2, 3000, if(p%4==1 && !issquare(p-floor(sqrt(p))^2) && !issquare(2*p-floor(sqrt(2*p))^2), s=concat(s, p))); s \\ Colin Barker, Jul 22 2014
    

Extensions

More terms from Colin Barker, Jul 22 2014

A276585 After a(0)=0, the first differences of A276583.

Original entry on oeis.org

0, 3, 3, 2, 3, 4, 3, 3, 3, 3, 5, 3, 3, 5, 5, 3, 5, 3, 4, 3, 5, 3, 4, 2, 3, 5, 3, 4, 4, 3, 5, 3, 4, 3, 3, 3, 5, 3, 4, 3, 5, 3, 5, 3, 4, 3, 3, 4, 3, 5, 3, 4, 3, 6, 3, 3, 5, 3, 4, 3, 6, 5, 3, 5, 3, 4, 3, 6, 3, 4, 3, 5, 3, 4, 3, 6, 3, 6, 3, 5, 3, 4, 3, 6, 3, 5, 3, 3, 5, 3, 4, 3, 6, 3, 5, 3, 2, 3, 5, 3, 4, 3, 6, 3, 5, 3, 4, 3, 5, 3, 4, 3, 6, 3, 5, 3, 3, 3, 3, 5, 3
Offset: 0

Views

Author

Antti Karttunen, Sep 07 2016

Keywords

Crossrefs

Formula

a(n) = A053610(A276583(n)).
a(0) = 0; for n >= 1, a(n) = A276583(n) - A276583(n-1).

A263651 Numbers n such that the difference between n and the largest square less than n is a nonzero square.

Original entry on oeis.org

2, 5, 8, 10, 13, 17, 20, 26, 29, 34, 37, 40, 45, 50, 53, 58, 65, 68, 73, 80, 82, 85, 90, 97, 101, 104, 109, 116, 122, 125, 130, 137, 145, 148, 153, 160, 170, 173, 178, 185, 194, 197, 200, 205, 212, 221, 226, 229, 234, 241, 250, 257, 260, 265, 272, 281, 290, 293, 298, 305
Offset: 1

Views

Author

Eli Jaffe, Oct 22 2015

Keywords

Comments

Numbers n such that A053186(n) is a positive square. - Michel Marcus, Oct 23 2015
Numbers of the form a^2 + b^2 where a >= 1 and 1 <= b^2 <= 2a. - Robert Israel, Oct 23 2015
Numbers n such that A053610(n) = 2. - Thomas Ordowski, May 22 2016

Examples

			For n=5, the largest square less than 5 is 4, and the difference between 4 and 5 is 1, which is also square.
		

Crossrefs

Cf. A053186.

Programs

  • Maple
    N:= 1000: # to get all terms <= N
    sort([seq(seq(a^2 + b^2, b=1..min(floor(sqrt(2*a)),floor(sqrt(N-a^2)))),a=1..floor(sqrt(N-1)))]); # Robert Israel, Oct 23 2015
  • Mathematica
    Select[Range@ 305, And[IntegerQ@ Sqrt[# - Floor[Sqrt@ #]^2], ! IntegerQ@ Sqrt@ #] &] (* Michael De Vlieger, Oct 23 2015 *)
  • PARI
    isok(n) = (d = (n - sqrtint(n)^2)) && issquare(d); \\ Michel Marcus, Oct 23 2015

Extensions

More terms from Michel Marcus, Oct 23 2015

A350178 Take n and subtract the greatest square less than or equal to n. Repeat this process until 0 is reached. a(n) is the sum of all residues after subtractions.

Original entry on oeis.org

0, 0, 1, 3, 0, 1, 3, 6, 4, 0, 1, 3, 6, 4, 6, 9, 0, 1, 3, 6, 4, 6, 9, 13, 12, 0, 1, 3, 6, 4, 6, 9, 13, 12, 9, 11, 0, 1, 3, 6, 4, 6, 9, 13, 12, 9, 11, 14, 18, 0, 1, 3, 6, 4, 6, 9, 13, 12, 9, 11, 14, 18, 17, 20, 0, 1, 3, 6, 4, 6, 9, 13, 12, 9, 11, 14, 18, 17, 20, 24, 16, 0, 1, 3, 6, 4, 6, 9, 13
Offset: 0

Views

Author

Thomas Scheuerle, Dec 18 2021

Keywords

Comments

Let s_1,s_2,s_3,...,s_m be the greedy partition of n into squares (n = s_1+s_2+s_3+...+s_m) such that s_1 >= s_2 >= s_3 >= ... >= s_m then a(n) = 0*s_1 + 1*s_2 + 2*s_3 + ... + (m-1)*s_m.
This sequence contains only numbers which can be written in the form c_1^2 + 2*c_2^2 + ... + m*c_m^2 with c_1 >= c_2 >= c_m. This excludes 2,5,7,8,... .

Examples

			a(41): 41 - 6^2 = 5; 5 - 2^2 = 1; 1 - 1^2 = 0 -> 5+1 = 6 = a(41).
		

Crossrefs

Programs

  • Mathematica
    Table[Total[Rest[NestWhileList[#-Floor[Sqrt[#]]^2&,n,#>0&]]],{n,0,90}] (* Harvey P. Dale, Apr 27 2025 *)
  • PARI
    A350178(n)={my(r=0); while(n-=sqrtint(n)^2, r+=n); r};

Formula

a(n) = n - r^2 + a(n - r^2) = a(n - r^2 + (b + r)^2) = a(n + b^2 + 2*b*r), r = floor(sqrt(n)), for any b >= 0. True because a(n) depends only on the distance to the next square <= n.
a(n) = Sum_{k>0} A053186^k(n).

A350698 Consider the positive squares summing to n as obtained by the greedy algorithm; a(n) is the least of these squares.

Original entry on oeis.org

1, 1, 1, 4, 1, 1, 1, 4, 9, 1, 1, 1, 4, 1, 1, 16, 1, 1, 1, 4, 1, 1, 1, 4, 25, 1, 1, 1, 4, 1, 1, 1, 4, 9, 1, 36, 1, 1, 1, 4, 1, 1, 1, 4, 9, 1, 1, 1, 49, 1, 1, 1, 4, 1, 1, 1, 4, 9, 1, 1, 1, 4, 1, 64, 1, 1, 1, 4, 1, 1, 1, 4, 9, 1, 1, 1, 4, 1, 1, 16, 81, 1, 1, 1
Offset: 1

Views

Author

Rémy Sigrist, Jan 12 2022

Keywords

Examples

			For n = 13:
- 13 = 3^2 + 2^2,
- so a(13) = 2^2.
		

Crossrefs

Programs

  • PARI
    a(n, e=2) = { my (r=0); while (n, r=sqrtnint(n, e); n-=r^e); r^e }

Formula

a(n^2) = n^2.
a(n) = A350674(n, A053610(n)).
Previous Showing 21-27 of 27 results.