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 90 results. Next

A276573 The infinite trunk of least squares beanstalk: The only infinite sequence such that a(0) = 0 and a(n-1) = a(n) - least number of squares (A002828) that sum to a(n).

Original entry on oeis.org

0, 3, 6, 8, 11, 15, 16, 18, 21, 24, 27, 30, 32, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 63, 64, 67, 70, 72, 75, 78, 80, 83, 85, 88, 90, 93, 96, 99, 102, 105, 108, 112, 115, 117, 120, 123, 126, 128, 131, 134, 136, 139, 143, 144, 147, 149, 152, 155, 158, 160, 162, 165, 168, 171, 173, 176, 179, 183, 186, 189, 192, 195
Offset: 0

Views

Author

Antti Karttunen, Sep 07 2016

Keywords

Crossrefs

Cf. A002828, A005563, A255131, A260731, A260733, A262689, A276572, A276574, A276575 (first differences), A277016 (squares present), A277015 (their square roots), A277888 (primes), A278486 (numbers one more than a prime), A278265, A278487, A278488, A278491 (another subsequence), A278497, A278498, A278499, A278513, A278516, A278517, A278518, A278519, A278521, A278522.
Cf. A277890 & A277891 (number of even and odd terms in each range. The latter seem to be slightly more numerous), A277889.
Positions of nonzero terms in A278515.
Subsequence of A278489, no common terms with A278490.
Cf. also A179016, A259934, A276583, A276613, A276623 for similar constructions.

Programs

Formula

a(n) = A276574(A276572(n)).
Other identities and observations. For all n >= 0:
A260731(a(n)) = n.
a(A260733(n+1)) = A005563(n).
A278517(n) <= a(n) <= A278519(n).
A010873(a(n)) = A278499(n). [Terms reduced modulo 4.]
A010877(a(n)) = A278488(n). [modulo 8.]
A046523(a(n)) = A278497(n). [Least number with the same prime signature.]
A008683(a(n)) = A278513(n).
A065338(a(n)) = A278498(n).
A278509(a(n)) = A278265(n).
A278216(a(n)) = A278516(n). [Number of children the n-th node of the trunk has.]

Extensions

Definition clarified and more identities added to the Formula section by Antti Karttunen, Nov 28 2016

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).

A260731 a(n) = Number of steps to reach 0 starting from x=n and using the iterated process: x -> x - A002828(x), where A002828(x) = the least number of squares that add up to x.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Aug 12 2015

Keywords

Crossrefs

Left inverse of A276573, A278517 and A278519. A278518(n) gives the number of times n occurs (run lengths).
Cf. also A261221.

Programs

  • Mathematica
    A002828[n_] := Which[n == 0, 0, SquaresR[1, n] > 0, 1, SquaresR[2, n] > 0, 2, SquaresR[3, n] > 0, 3, True, 4]; a[0] = 0; a[n_] := a[n] = 1 + a[n - A002828[n]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Nov 14 2016 *)

Formula

a(0) = 0; for >= 1, a(n) = 1 + A260731(A255131(n)).
From Antti Karttunen, Nov 28 2016: (Start)
For all n >= 0, a(A278517(n)) = a(A278519(n)) = a(A276573(n)) = n.
(End)

A260733 a(n) = number of steps needed to reach zero when starting from k = (n^2)-1 and repeatedly applying the map that replaces k with k - A002828(k), where A002828(k) = the least number of squares that add up to k.

Original entry on oeis.org

0, 1, 3, 5, 9, 13, 18, 23, 30, 37, 44, 52, 62, 71, 81, 91, 104, 117, 131, 144, 159, 174, 190, 207, 224, 243, 262, 281, 301, 321, 343, 365, 388, 412, 437, 461, 487, 514, 539, 567, 596, 625, 654, 684, 715, 748, 781, 814, 848, 883, 918, 955, 991, 1030, 1067, 1105, 1145, 1187, 1227, 1269, 1311, 1354, 1396, 1441, 1486, 1531, 1579, 1624, 1673, 1723, 1773, 1821
Offset: 1

Views

Author

Antti Karttunen, Aug 12 2015

Keywords

Crossrefs

One less than A260732.
Cf. also A261223.

Programs

  • Mathematica
    Table[Length[#] - 2 &@ NestWhileList[# - (If[First@ # > 0, 1, Length[ First@ Split@ #] + 1] &@ SquaresR[Range@ 4, #]) &, n^2, # != 0 &], {n, 72}] (* Michael De Vlieger, Sep 08 2016 *)

Formula

a(n) = A260731((n^2)-1).
a(n) = A260732(n)-1.

A260734 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 - A002828(k), where A002828(k) = the least number of squares that add up to k.

Original entry on oeis.org

1, 2, 2, 4, 4, 5, 5, 7, 7, 7, 8, 10, 9, 10, 10, 13, 13, 14, 13, 15, 15, 16, 17, 17, 19, 19, 19, 20, 20, 22, 22, 23, 24, 25, 24, 26, 27, 25, 28, 29, 29, 29, 30, 31, 33, 33, 33, 34, 35, 35, 37, 36, 39, 37, 38, 40, 42, 40, 42, 42, 43, 42, 45, 45, 45, 48, 45, 49, 50, 50, 48, 53, 50, 51, 54, 52, 53, 54, 56, 56, 56, 58, 59, 59, 60, 60, 60, 61, 62, 62, 62, 65, 66, 66, 65
Offset: 1

Views

Author

Antti Karttunen, Aug 12 2015

Keywords

Crossrefs

First differences of both A260732 and A260733.
Cf. also A261224.

Programs

  • Mathematica
    Table[Length[#] - 1 &@ NestWhileList[# - (If[First@ # > 0, 1, Length[ First@ Split@ #] + 1] &@ SquaresR[Range@ 4, #]) &, ((n + 1)^2) - 1, # != (n^2) - 1 &], {n, 95}] (* Michael De Vlieger, Sep 08 2016, after Harvey P. Dale at A002828 *)

Formula

a(n) = A260731(((n+1)^2)-1) - A260731((n^2)-1). [The definition.]
Equally, for all n >= 1:
a(n) = A260731((n+1)^2) - A260731(n^2).
a(n) = A260732(n+1) - A260732(n).
a(n) = A260733(n+1) - A260733(n).

A260732 a(n) = number of steps needed to reach zero when starting from k = n^2 and repeatedly applying the map that replaces k with k - {the least number of squares (A002828) that add up to k}.

Original entry on oeis.org

0, 1, 2, 4, 6, 10, 14, 19, 24, 31, 38, 45, 53, 63, 72, 82, 92, 105, 118, 132, 145, 160, 175, 191, 208, 225, 244, 263, 282, 302, 322, 344, 366, 389, 413, 438, 462, 488, 515, 540, 568, 597, 626, 655, 685, 716, 749, 782, 815, 849, 884, 919, 956, 992, 1031, 1068, 1106, 1146, 1188, 1228, 1270, 1312, 1355, 1397, 1442, 1487, 1532, 1580, 1625
Offset: 0

Views

Author

Antti Karttunen, Aug 12 2015

Keywords

Crossrefs

Partial sums of A260734.
Essentially one more than A260733.
Cf. also A261222.

Programs

  • Mathematica
    Table[Length[#] - 1 &@ NestWhileList[# - (If[First@ # > 0, 1, Length[ First@ Split@ #] + 1] &@ SquaresR[Range@ 4, #]) &, n^2, # != 0 &], {n, 0, 68}] (* Michael De Vlieger, Sep 08 2016, after Harvey P. Dale at A002828 *)

Formula

a(n) = A260731(n^2).
For all n >= 1: a(n) = 1 + A260733(n).

A277487 a(n) = number of primes encountered before reaching (n^2)-1 when starting from k = ((n+1)^2)-1 and iterating map k -> k - A002828(k).

Original entry on oeis.org

1, 0, 1, 0, 0, 1, 2, 1, 1, 0, 2, 1, 2, 0, 3, 2, 0, 3, 0, 2, 0, 1, 4, 2, 3, 2, 4, 2, 0, 3, 3, 2, 5, 3, 4, 3, 3, 3, 2, 4, 2, 2, 4, 3, 3, 3, 6, 3, 1, 3, 4, 2, 6, 3, 3, 2, 5, 5, 5, 5, 4, 3, 7, 4, 4, 6, 4, 2, 4, 6, 5, 5, 5, 4, 7, 4, 4, 7, 4, 0, 5, 6, 7, 4, 4, 9, 4, 5, 2, 6, 6, 7, 11, 3, 6, 4, 9, 5, 7, 7, 7, 6, 8, 8, 7, 6, 4, 6, 5, 7, 8, 5, 9, 8, 8, 5, 12, 7, 5, 6
Offset: 1

Views

Author

Antti Karttunen, Nov 08 2016

Keywords

Comments

Number of primes on row n of A276574, after the initial zero-row.
Note how for the most n in range 1..10000, a(n) < A277486(n), even though for the most n in the same range A277890(n) < A277891(n). In range n=1..10000, there are only 209 cases where a(n) >= A277486(n).
On the other hand, when a(n) is compared to A277488(n), there is no such marked bias.

Examples

			For n=3, starting from k = ((3+1)^2)-1, and iterating k -> A255131(k), yields 15 -> 11 -> 8, where the iteration stops as the next lower number one less than a square has been reached. Of these numbers only 11 is a prime, thus a(3) = 1.
		

Crossrefs

Programs

  • PARI
    istwo(n:int)=my(f); if(n<3, return(n>=0); ); f=factor(n>>valuation(n, 2)); for(i=1, #f[, 1], if(bitand(f[i, 2], 1)==1&&bitand(f[i, 1], 3)==3, return(0))); 1
    isthree(n:int)=my(tmp=valuation(n, 2)); bitand(tmp, 1)||bitand(n>>tmp, 7)!=7
    A002828(n)=if(issquare(n), !!n, if(istwo(n), 2, 4-isthree(n))) \\ From Charles R Greathouse IV, Jul 19 2011
    A277487(n) = { my(orgk = ((n+1)^2)-1); my(k = orgk, s = 0); while(((k == orgk) || !issquare(1+k)), s = s + if(isprime(k),1,0); k = k - A002828(k)); s; };
    for(n=1, 10000, write("b277487.txt", n, " ", A277487(n)));
    
  • Scheme
    (define (A277487 n) (let ((org_k (- (A000290 (+ 1 n)) 1))) (let loop ((k org_k) (s 0)) (if (and (< k org_k) (= 1 (A010052 (+ 1 k)))) s (loop (- k (A002828 k)) (+ s (A010051 k)))))))

Formula

a(n) <= A277891(n).

A262689 a(n) = largest number k <= A000196(n) for which A002828(n-(k^2)) = A002828(n)-1.

Original entry on oeis.org

0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 2, 3, 3, 3, 4, 4, 3, 3, 4, 4, 3, 3, 4, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5, 5, 6, 6, 6, 6, 6, 5, 5, 5, 6, 6, 6, 6, 4, 7, 7, 7, 6, 7, 7, 7, 6, 7, 7, 7, 7, 6, 7, 7, 8, 8, 8, 7, 8, 8, 6, 7, 6, 8, 7, 7, 6, 8, 7, 7, 8, 9, 9, 9, 8, 9, 9, 9, 6, 8, 9, 9, 9, 8, 9, 9, 8, 9, 7, 9, 10, 10, 10, 10, 10, 10, 9, 9, 10, 10, 10, 10, 10, 8, 8, 9, 10, 9, 10, 10, 10, 11
Offset: 0

Views

Author

Antti Karttunen, Oct 03 2015

Keywords

Comments

a(n) = square root of the largest summand present among all representations of n as a minimal number of squares, A002828(n). See the last two examples.

Examples

			For n = 9, we have A002828(9) = 1 because 9 is itself a perfect square. By the definition of this sequence, we find the largest k <= 3 for which A002828(9 - k^2) = A002828(9)-1 = 0, and it is k=3 that satisfies this condition, thus a(9) = 3.
For n = 27, by the other interpretation given in the Comments section, we see that the two minimal sums requiring the least number of squares (= 3 = A002828(27)) are (25 + 1 + 1) and (9 + 9 + 9). As 25 is larger than 9, we have a(27) = sqrt(25) = 5.
For n = 33, the two minimal solutions are (25 + 4 + 4) and (16 + 16 + 1). As 25 is larger than 16, we have a(33) = sqrt(25) = 5.
		

Crossrefs

Differs from A064876 for the first time at n=33, where a(33) = 5, while A064876(33) = 4.

Formula

Other identities. For all n >= 0:
a(n) = A000196(A262690(n)).
a(n^2) = n.

A277486 a(n) = number of integers one more than a prime encountered before reaching (n^2)-1 when starting from k = ((n+1)^2)-1 and iterating map k -> k - A002828(k).

Original entry on oeis.org

1, 2, 0, 2, 2, 2, 0, 2, 1, 2, 1, 3, 1, 3, 1, 3, 3, 2, 3, 3, 5, 4, 1, 4, 3, 4, 2, 4, 4, 2, 4, 4, 4, 3, 3, 4, 3, 4, 5, 5, 5, 4, 4, 6, 6, 3, 3, 9, 4, 5, 6, 9, 4, 6, 4, 4, 8, 6, 5, 7, 5, 9, 5, 5, 7, 8, 6, 11, 5, 9, 4, 7, 9, 9, 6, 10, 5, 5, 17, 4, 10, 9, 10, 7, 3, 3, 10, 8, 7, 10, 6, 9, 5, 10, 10, 10, 8, 11, 6, 9, 10, 7, 7, 7, 7, 12, 9, 11, 13, 9, 12, 6, 10, 9, 6
Offset: 1

Views

Author

Antti Karttunen, Nov 08 2016

Keywords

Examples

			For n=6, we start iterating from k = ((6+1)^2)-1 = 48, and then 48 - A002828(48) = 45, 45 - A002828(45) = 43, 43 - A002828(43) = 40, 40 - A002828(40) = 38, and 38 - A002828(38) = 35 (which is 6^2 - 1), and when we subtract one from each, only 47 and 37 are primes, thus a(6) = 2.
For n=7, we start iterating from k = ((7+1)^2)-1 = 63, and 63 -> 59, 59 -> 56, 56 -> 53, 53 -> 51, 51 -> 48 (which is 7^2 - 1), and subtracting one from each of 63, 59, 56, 53 and 51, doesn't yield a prime for any, thus a(7)=0. (Note that even though 48-1 = 47 is a prime, it is not included in the count for n=7).
		

Crossrefs

Programs

  • PARI
    istwo(n:int)=my(f); if(n<3, return(n>=0); ); f=factor(n>>valuation(n, 2)); for(i=1, #f[, 1], if(bitand(f[i, 2], 1)==1&&bitand(f[i, 1], 3)==3, return(0))); 1
    isthree(n:int)=my(tmp=valuation(n, 2)); bitand(tmp, 1)||bitand(n>>tmp, 7)!=7
    A002828(n)=if(issquare(n), !!n, if(istwo(n), 2, 4-isthree(n))) \\ From Charles R Greathouse IV, Jul 19 2011
    A277486(n) = { my(orgk = ((n+1)^2)-1); my(k = orgk, s = 0); while(((k == orgk) || !issquare(1+k)), s = s + if(isprime(k-1),1,0); k = k - A002828(k)); s; };
    for(n=1, 10000, write("b277486.txt", n, " ", A277486(n)));
    
  • Scheme
    (define (A277486 n) (let ((org_k (- (A000290 (+ 1 n)) 1))) (let loop ((k org_k) (s 0)) (if (and (< k org_k) (= 1 (A010052 (+ 1 k)))) s (loop (- k (A002828 k)) (+ s (A010051 (+ -1 k))))))))

Formula

For n >= 2, a(n) <= A277890(n).

A277890 Number of even numbers encountered before (n^2)-1 is reached when starting from k = ((n+1)^2)-1 and iterating map k -> k - A002828(k).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Nov 08 2016

Keywords

Comments

The starting point ((n+1)^2)-1 of the iteration is included if it is even, but the ending point (n^2)-1 is never included in the count.
a(n) = number of even numbers on row n of A276574, after the initial zero-row.
See also comments in A277891.

Examples

			For n=6, we start iterating from k = ((6+1)^2)-1 = 48, and then 48 - A002828(48) = 45, 45 - A002828(45) = 43, 43 - A002828(43) = 40, 40 - A002828(40) = 38, and 38 - A002828(38) = 35 (which is 6^2 - 1), and three of these numbers are even, thus a(6) = 3.
		

Crossrefs

Programs

  • PARI
    istwo(n:int)=my(f); if(n<3, return(n>=0); ); f=factor(n>>valuation(n, 2)); for(i=1, #f[, 1], if(bitand(f[i, 2], 1)==1&&bitand(f[i, 1], 3)==3, return(0))); 1
    isthree(n:int)=my(tmp=valuation(n, 2)); bitand(tmp, 1)||bitand(n>>tmp, 7)!=7
    A002828(n)=if(issquare(n), !!n, if(istwo(n), 2, 4-isthree(n))) \\ From Charles R Greathouse IV, Jul 19 2011
    A277890(n) = { my(orgk = ((n+1)^2)-1); my(k = orgk, s = 0); while(((k == orgk) || !issquare(1+k)), s = s + (1-(k%2)); k = k - A002828(k)); s; };
    for(n=1, 10000, write("b277890.txt", n, " ", A277890(n)));
    
  • Scheme
    (define (A277890 n) (let ((org_k (- (A000290 (+ 1 n)) 1))) (let loop ((k org_k) (s 0)) (if (and (< k org_k) (= 1 (A010052 (+ 1 k)))) s (loop (- k (A002828 k)) (+ s (- 1 (A000035 k))))))))

Formula

a(n) + A277891(n) = A260734(n).
For n >= 2, a(n) >= A277486(n).
a(n) >= A277488(n).
Showing 1-10 of 90 results. Next