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

A255131 n minus the least number of squares that add up to n: a(n) = n - A002828(n).

Original entry on oeis.org

0, 0, 0, 0, 3, 3, 3, 3, 6, 8, 8, 8, 9, 11, 11, 11, 15, 15, 16, 16, 18, 18, 19, 19, 21, 24, 24, 24, 24, 27, 27, 27, 30, 30, 32, 32, 35, 35, 35, 35, 38, 39, 39, 40, 41, 43, 43, 43, 45, 48, 48, 48, 50, 51, 51, 51, 53, 54, 56, 56, 56, 59, 59, 59, 63, 63, 63, 64, 66, 66, 67, 67, 70, 71, 72, 72, 73, 74, 75, 75, 78, 80, 80, 80, 81
Offset: 0

Views

Author

Antti Karttunen, Feb 24 2015

Keywords

Comments

The associated beanstalk-sequence starts from a(0) as: 0, 3, 6, 8, 11, 15, 16, 18, 21, ... (A276573).

Examples

			a(0) = 0, because no squares are needed for an empty sum, and 0 - 0 = 0.
a(3) = 0, because 3 cannot be represented as a sum of less than three squares (1+1+1), and 3 - 3 = 0.
a(4) = 3, because 4 can be represented as a sum of just one square (namely 4 itself), and 4 - 1 = 3.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local F, x;
       if issqr(n) then return n-1 fi;
       if nops(select(t -> t[1] mod 4 = 3 and t[2]::odd, ifactors(n)[2])) = 0 then return n-2 fi;
       x:= n/4^floor(padic:-ordp(n, 2)/2);
       if x mod 8 = 7 then n-4 else n-3 fi
    end proc:
    f(0):= 0:
    map(f, [$0..100]); # Robert Israel, Mar 27 2018
  • Mathematica
    {0}~Join~Table[n - (If[First@ # > 0, 1, Length[First@ Split@ #] + 1] &@ SquaresR[Range@ 4, n]), {n, 84}] (* Michael De Vlieger, Sep 08 2016, after Harvey P. Dale at A002828 *)

Formula

a(n) = n - A002828(n).
a(n) = A260740(n) + A062535(n).

A261222 a(n) = number of steps to reach 0 when starting from k = n*n and repeatedly applying the map that replaces k with k - A053610(k), where A053610(k) = the number of positive squares that sum to k using the greedy algorithm.

Original entry on oeis.org

0, 1, 2, 4, 6, 9, 12, 15, 19, 24, 29, 35, 41, 48, 55, 62, 70, 78, 87, 97, 107, 118, 129, 141, 153, 165, 178, 191, 205, 219, 234, 249, 265, 282, 299, 317, 335, 354, 373, 392, 412, 433, 454, 475, 497, 519, 542, 565, 589, 613, 638, 664, 690, 717, 744, 772, 800, 828, 857, 887, 917, 948, 979, 1010, 1042, 1074, 1107, 1140, 1174, 1208, 1243, 1278, 1314, 1351, 1388, 1426, 1464, 1503
Offset: 0

Views

Author

Antti Karttunen, Aug 12 2015

Keywords

Crossrefs

Essentially one more than A261223.
First differences: A261224.
Cf. also A260732, A261227.

Programs

  • Mathematica
    Table[-1 + Length@ NestWhileList[# - Block[{m = #, c = 1}, While[a = (# - Floor[Sqrt@ #]^2) &@ m; a != 0, c++; m = a]; c] &, n^2, # != 0 &], {n, 0, 77}] (* Michael De Vlieger, Sep 08 2016, after Jud McCranie at A053610 *)

Formula

a(n) = A261221(n^2).
Other identities. For all n >= 1:
a(n) = 1 + A261223(n).

A261223 a(n) = number of steps to reach 0 when starting from k = (n*n)-1 and repeatedly applying the map that replaces k with k - A053610(k), where A053610(k) = the number of positive squares that sum to k using the greedy algorithm.

Original entry on oeis.org

0, 1, 3, 5, 8, 11, 14, 18, 23, 28, 34, 40, 47, 54, 61, 69, 77, 86, 96, 106, 117, 128, 140, 152, 164, 177, 190, 204, 218, 233, 248, 264, 281, 298, 316, 334, 353, 372, 391, 411, 432, 453, 474, 496, 518, 541, 564, 588, 612, 637, 663, 689, 716, 743, 771, 799, 827, 856, 886, 916, 947, 978, 1009, 1041, 1073, 1106, 1139, 1173, 1207, 1242, 1277, 1313, 1350, 1387, 1425, 1463, 1502, 1541
Offset: 1

Views

Author

Antti Karttunen, Aug 12 2015

Keywords

Crossrefs

One less than A261222.
Cf. also A260733, A261228.

Programs

  • Mathematica
    Table[-2 + Length@ NestWhileList[# - Block[{m = #, c = 1}, While[a = (# - Floor[Sqrt@ #]^2) &@ m; a != 0, c++; m = a]; c] &, (n + 1)^2, # != 0 &], {n, 0, 77}] (* Michael De Vlieger, Sep 08 2016, after Jud McCranie at A053610 *)

Formula

a(n) = A261221((n^2)-1).
a(n) = A261222(n)-1.

A261224 a(n) = number of steps needed to reach (n^2)-1 when starting from k = ((n+1)^2)-1 and repeatedly applying the map that replaces k with k - A053610(k), where A053610(k) = the number of positive squares that sum to k using the greedy algorithm.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Aug 12 2015

Keywords

Crossrefs

First differences of both A261222 and A261223.
Cf. also A260734, A261229.

Programs

  • Mathematica
    Table[-1 + Length@ NestWhileList[# - Block[{m = #, c = 1}, While[a = (# - Floor[Sqrt@ #]^2) &@ m; a != 0, c++; m = a]; c] &, ((n + 1)^2) - 1, # != n^2 - 1 &], {n, 91}] (* Michael De Vlieger, Sep 08 2016, after Jud McCranie at A053610 *)

Formula

a(n) = A261221(((n+1)^2)-1) - A261221((n^2)-1). [The definition.]
Equally, for all n >= 1:
a(n) = A261221((n+1)^2) - A261221(n^2).
a(n) = A261222(n+1) - A261222(n).
a(n) = A261223(n+1) - A261223(n).

A261225 n minus the number of positive cubes needed to sum to n using the greedy algorithm: a(n) = n - A055401(n).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 14, 14, 14, 14, 14, 14, 14, 14, 21, 21, 21, 26, 26, 26, 26, 26, 26, 26, 26, 33, 33, 33, 33, 33, 33, 33, 33, 40, 40, 40, 40, 40, 40, 40, 40, 47, 47, 47, 52, 52, 52, 52, 52, 52, 52, 52, 59, 59, 63, 63, 63, 63, 63, 63, 63, 63, 70, 70, 70, 70, 70, 70, 70, 70, 77, 77, 77, 77, 77, 77, 77, 77, 84, 84, 84, 89
Offset: 0

Views

Author

Antti Karttunen, Aug 16 2015

Keywords

Examples

			a(8) = 7, because when the greedy algorithm partitions 8 into cubes, it first finds 8 (= 2*2*2), thus A055401(8) = 1, and 8-1 = 7.
		

Crossrefs

Formula

a(n) = n - A055401(n).
As a recurrence:
a(0) = 0; for n >= 1, a(n) = -1 + A048762(n) + a(n-A048762(n)). [Where A048762(n) gives the largest cube <= n.]

A276583 The infinite trunk of greedy squares beanstalk: The only infinite sequence such that a(n-1) = a(n) - number of squares that sum to a(n) with greedy algorithm (A053610).

Original entry on oeis.org

0, 3, 6, 8, 11, 15, 18, 21, 24, 27, 32, 35, 38, 43, 48, 51, 56, 59, 63, 66, 71, 74, 78, 80, 83, 88, 91, 95, 99, 102, 107, 110, 114, 117, 120, 123, 128, 131, 135, 138, 143, 146, 151, 154, 158, 161, 164, 168, 171, 176, 179, 183, 186, 192, 195, 198, 203, 206, 210, 213, 219, 224, 227, 232, 235, 239, 242, 248, 251, 255
Offset: 0

Views

Author

Antti Karttunen, Sep 07 2016

Keywords

Crossrefs

Cf. A053610, A260740, A276582, A276584, A276585 (first differences).
Cf. also A179016, A259934, A276573, A276613, A276623 for similar constructions.

Programs

Formula

a(n) = A276584(A276582(n)).

A261221 a(n) = number of steps to reach 0 when starting from k = n and repeatedly applying the map that replaces k with k - A053610(k), where A053610(k) = the number of positive squares needed to sum to k using the greedy algorithm.

Original entry on oeis.org

0, 1, 1, 1, 2, 2, 2, 2, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 21, 22, 22, 22, 23, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29
Offset: 0

Views

Author

Antti Karttunen, Aug 12 2015

Keywords

Crossrefs

Formula

a(0) = 0; for n >= 1, a(n) = 1 + a(A260740(n)).

A276584 The infinite trunk of greedy squares beanstalk with reversed subsections.

Original entry on oeis.org

0, 3, 8, 6, 15, 11, 24, 21, 18, 35, 32, 27, 48, 43, 38, 63, 59, 56, 51, 80, 78, 74, 71, 66, 99, 95, 91, 88, 83, 120, 117, 114, 110, 107, 102, 143, 138, 135, 131, 128, 123, 168, 164, 161, 158, 154, 151, 146, 195, 192, 186, 183, 179, 176, 171, 224, 219, 213, 210, 206, 203, 198, 255, 251, 248, 242, 239, 235, 232, 227
Offset: 0

Views

Author

Antti Karttunen, Sep 07 2016 and Sep 09 2016

Keywords

Crossrefs

Programs

  • Scheme
    (definec (A276584 n) (cond ((zero? n) n) ((= 1 n) 3) (else (let ((maybe_next (A260740 (A276584 (- n 1))))) (if (zero? (A010052 (+ 1 maybe_next))) maybe_next (+ -1 (A000290 (+ 2 (A000196 (+ 1 maybe_next))))))))))

Formula

a(0) = 0; a(1) = 3; for n > 1, if A260740(a(n-1))+1 is not a square, then a(n) = A260740(a(n-1)), otherwise a(n) = A000290(2+A000196(A260740(a(n-1)))) - 1.
Showing 1-8 of 8 results.