

A308702


a(n) is the least integer k such that both k^2+2*n1 and k^2+4*n are squares.


2



1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 3, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

2,2


COMMENTS

Motivated by the following original problem: the population of a city is a square number. With 100 more people, it would be a square plus one, with again 100 more people it would be a square. What is the initial population of the city? Answer: 2401. See Images des Mathématiques link.
One remarks that one can solve the problem when the population increase is even and greater than 1. So in the sequence definition, 2*n is the population increase and k^2 is the initial population.
One also notes that a(n) always exists with a(n) <= n1.


LINKS

Michel Marcus, Table of n, a(n) for n = 2..1000
Ana Rechtman, Juin 1er défi, Images des Mathématiques, CNRS, 2019 (in French).


EXAMPLE

For n=2, that is a population increase of 4, the population is 1 (a square), since we have 1+41 = 4 (a square) and 1+8 = 9 (a square).
For n=28, that is a population increase of 56, the population is 9 (a square), since we have 9+561 = 64 (a square) and 9+112 = 121 (a square).


MATHEMATICA

okQ[m_, k_] := IntegerQ[Sqrt[m]] && IntegerQ[Sqrt[m+k1]] && IntegerQ[ Sqrt[m+2k]];
findm[k_] := Module[{m = 1}, While[!okQ[m^2, k], m++]; m];
a[n_] := findm[2n];
Table[a[n], {n, 2, 72}] (* JeanFrançois Alcover, Jun 18 2019, from PARI *)


PROG

(PARI) isok(m, k) = issquare(m) && issquare(m+k1) && issquare(m+2*k);
findm(k) = my(m=1); while (!isok(m^2, k), m++); m;
a(n) = findm(2*n);


CROSSREFS

Cf. A000290 (squares), A308703.
Sequence in context: A295886 A318893 A137317 * A326200 A094759 A214701
Adjacent sequences: A308699 A308700 A308701 * A308703 A308704 A308705


KEYWORD

nonn


AUTHOR

Michel Marcus, Jun 18 2019


STATUS

approved



