The number 48 is special in that if you add one to it, or add one to half of it, the sum is a perfect square, i.e.:
48 + 1 = 49 = 7 * 7Using your favorite calculator how many more can you find?
48/2 + 1 = 25 = 5 * 5
The following warnings occurred: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key 146101 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
|
Mini Challenge
|
|
« Next Oldest | Next Newest »
|
▼
01-22-2009, 05:00 PM
The number 48 is special in that if you add one to it, or add one to half of it, the sum is a perfect square, i.e.: 48 + 1 = 49 = 7 * 7Using your favorite calculator how many more can you find? ▼
01-22-2009, 06:10 PM
Not many on my 41 without the MPL...
as X/2 need to be an integer, X needs to be even. So we have 2n+1 = A^2with A and B odd. The code below tries all odd numbers from the start number to see if (A^2-1)/2 + 1 is a perfect square, in which case it shows it via XEQ 01 until the next one is found.
So far it has found 48, 1680, 57120, 1940448, 2239277040...
Lbl 'EF'edit - found a typo Edited: 22 Jan 2009, 6:20 p.m.
01-22-2009, 06:11 PM
My 49g+ is dead. I pulled it out to do this challenge and there is a big ink blob inside the screen. The LCD has died :-( Anyway, without that resource, I fired up *sfix and entered this program:
<< 0 48 1 5 START OVER NEG 48 + OVER 34 * + NEXT >> Which gives the first seven terms of the sequence. Change the 5 before the START to whatever you want to generate more. - Pauli
Edited: 22 Jan 2009, 9:12 p.m. ▼
01-22-2009, 11:07 PM
If I'm reading this code right, it basically says that if you know the two previous values in the sequence X and Y, then the next value is 34Y-X+48. Can you explain why this formula gives the right answer?
Thanks, ▼
01-23-2009, 12:13 PM
I'm not 100% sure, but check out this link about the Pell Equation and scroll down to Solution Technique where they show how you can generate subsequent solutions iteratively. I feel actually quite stupid (aka my normal state of mind) for not figuring out that this is again a Pell equation, even after I wrote down the challenge in a more general form! And seeing that all solutions are divisible by 48... HTH Cheers Peter ▼
01-23-2009, 11:27 PM
If you also realise that (n/2+1)(n+1) being a perfect square is equivalent to the mini challenge problem (since n/2+1 and n+1 are coprime) then you'll see the connection to Sloane A078522. - Pauli
01-22-2009, 06:22 PM
And a 15c version:
001-42,21,11 LBL A This version keeps spitting numbers out until your press R/S or it overflows. - Pauli
Edited: 22 Jan 2009, 9:11 p.m.
01-22-2009, 09:10 PM
And a 16c version that takes advantage of the 64 bit decimal mode to the go further:
001-43,22, A LBL A
This produces these numbers: 48 - Pauli
Edited: 22 Jan 2009, 9:11 p.m.
01-22-2009, 10:49 PM
n + 1 = x2
x2 - 2y2 = -1 What a suprise: a Pell equation! Here's my program for HP-41C using brute force:
01 -1 15 - It might be faster in assembler though.
Nevertheless it gives enough values to find the sequence: ▼
01-23-2009, 07:22 AM
Hi,
Note, that before n=48, n=0 is a valid solution since : 0 + 1 = 12 Following list of intergers n using an HP-28S (HP-28C will do it too):
# 0d
Edited: 23 Jan 2009, 7:26 a.m.
01-25-2009, 01:58 PM
Quote:I found this problem in Recreations in the Theory of Numbers by Beiler. This very inexpensive Dover reprint is very well written and a lot of fun. Chapter 22 (The Pellian) is entirely devoted to Pell Equations. NOTE: All code will be end of this post. MC1: Brute Force
As Thomas pointed out: Quote:This program takes a single argument (number of solutions to find), then sequentially tests each odd square. The output below took over an hour (I stopped watching) with an input of 7. MC2: Algebraic As Thomas pointed out x2 - 2y2 = -1 is a Pell Equation. Clearly x = 1 and y = 1. To find any x the following can be use: x = [(1 + sqrt(2))r + (1 - sqrt(2))r]/2. However, r must be odd. See Beiler for details.
This program counts odds from 1 to 13 to find the first seven solutions in seconds. NOTE: the 7th solution is a bit off (rounding error), however the following 50g version does not have this problem: << 1 13 FOR r 1 2 v/ + r ^ 1 2 v/ - r ^ + 2 / 2 ^ 1 - EVAL 2 STEP >> MC3: Recurrence Relation As Peter pointed out this can be found here: http://en.wikipedia.org/wiki/Pell%27s_equation. However, like MC2, for this type of Pell Equation (-1) only every other recurrence will have a valid solution. Solving for xn+2 a new recurrence relation can be obtained: xn+1 = 3xn + sqrt(8(xn2 + 1)). This program will compute the first 7 solutions in seconds. This was my final solution. MC4: Recurrence Relation This identical to Pauli's 50g version (thanks for the incredible find (A078522)). This program will find the first 7 solutions in seconds.
The On-Line Encyclopedia of Integer Sequences is treasure trove of integer sequences. You can find many interesting solutions there, e.g. when I searched for 1, 49, 1681 I found A008843 and created the following 15C version: 001 LBL A 010 xNote the requirement for complex numbers and hyperbolic functions. To use, just enter the term you want (1 through 7). NOTE: the 7th solution is a bit off. 41CX Code and Results
I liked this problem because there were so many ways to write programs for it. Thanks all for participating.
Edited: 25 Jan 2009, 2:19 p.m. ▼
01-25-2009, 06:05 PM
I thank you for posting it and for the great writeup! Great job Egan! Cheers Peter ▼
01-27-2009, 01:03 PM
Seeing as Egan took the trouble to pose the Mini-Challenge it is only fitting (polite) to respond with any programs that have been developed. I generally have a go at all of the challenges that are posed but have possibly not posted my programs sometimes because I have thought it too late or the programming not good enough. I suspect that I am just one of many who think this but this is the type of attitude that possibly contributed to the demise of previous challenges which I thoroughly enjoyed. ▼
01-27-2009, 06:15 PM
Quote:Both. What I like about calculator challenges is that for many of them you need to have an in-depth understanding of the problem to effectively get results from 1980s hand-held tech in a reasonable amount of time. Quote:You are welcome. Thanks for participating. |