login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A262689 a(n) = largest number k <= A000196(n) for which A002828(n-(k^2)) = A002828(n)-1. 7

%I #20 Sep 09 2017 19:25:15

%S 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,

%T 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,

%U 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

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

%C 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.

%H Antti Karttunen, <a href="/A262689/b262689.txt">Table of n, a(n) for n = 0..65536</a>

%F Other identities. For all n >= 0:

%F a(n) = A000196(A262690(n)).

%F a(n^2) = n.

%e 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.

%e 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.

%e 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.

%o (Scheme, two versions)

%o ;; The first version requires that we already know how to compute A002828 without resorting to this same sequence, e.g. by Lagrange's "Four Squares theorem":

%o (define (A262689 n) (if (= 1 (A010052 n)) (A000196 n) (let ((t (- (A002828 n) 1))) (let loop ((k (A000196 n))) (if (= t (A002828 (- n (* k k)))) k (loop (- k 1)))))))

%o ;; The second version is based on a more general minimalizing approach. We use memoizing-macro definec for faster computation:

%o (definec (A262689 n) (let ((k (A000196 n))) (if (= 1 (A010052 n)) k (let loop ((k k) (m #f) (mk #f)) (cond ((zero? k) mk) (else (let* ((c (A002828 (- n (* k k))))) (if (or (not m) (< c m)) (loop (- k 1) c k) (loop (- k 1) m mk)))))))))

%o ;; The latter version makes it possible to compute A002828 naively, in a simple mutual recursion with this sequence:

%o (definec (A002828 n) (if (zero? n) n (+ 1 (A002828 (- n (A000290 (A262689 n)))))))

%Y Cf. A000196, A002828, A010052, A064876, A180466, A262690.

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

%K nonn

%O 0,5

%A _Antti Karttunen_, Oct 03 2015

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 16:21 EDT 2024. Contains 371794 sequences. (Running on oeis4.)