You are not logged in.
Growing...
{1, 3, 6, 10, 15, 21, 4, 5, 11, 14, 2, 7, 9, 16, 20, 29, 35, 46, 18, 31, 33, 48, 52, 12, 13, 23, 26, 38, 43, 57, 24, 25, 39, 42, 22, 27, 37, 44, 56, 8, 17, 19, 30, 34, 47, 53, 28, 36, 45, 55, 66, 78, 91, 105, 64, 80, 41, 40, 60, 61, 83, 86, 58, 63, 81, 88, 108, 117, 79, 65, 104, 92, 77, 67, 54, 90, 106, 119, 50, 71, 73, 96, 100, 69, 75, 94, 102, 123, 133, 156, 168}
Length-91
MaxNumber-168
IPBLE: Increasing Performance By Lowering Expectations.
Offline
Ehy seems to be cool.
If u want can u send me the algorithm? [if u want for sure!]
on leopardus@inwind.it
However thank u...
We need to understand which is this minimum n....
Offline
I generalized my algoritm and inproved my program. Now it the first member don't have to be 1.
IPBLE: Increasing Performance By Lowering Expectations.
Offline
here's my algoritm:
Let sqsei(x) give the smallest perfect square, greater than x.
a[1]=k-arbitary
How to find a[f]?
1.We calculate sqsei[a[f-1]]-a[f-1]. Let this be k.
2.If k is different with all numbers a[1],a[2],...,a[f-1] then a[f]=k.
3.If not, the new value of k must be sqsei[k+a[f-1]]-a[f-1] and we repeat step 3.
If a[f]+k=sqsei(a[f]) then the square chain is also circular.
Last edited by krassi_holmz (2005-12-29 03:21:20)
IPBLE: Increasing Performance By Lowering Expectations.
Offline
I wrote my program on Mathematica language and it has some extra properties:
Last edited by krassi_holmz (2005-12-29 03:53:28)
IPBLE: Increasing Performance By Lowering Expectations.
Offline
I wrote my program in Mathematica language and it has some extra properties:
Oh Mathematica! I thought something like C/C++. Coz I dunno how to check if the sum of 2 consecutive numbers is perfect square??!
When the sum of 2 numbers is a perfect square?
if (a+b) = ?!?!
Offline
I'll tell you. I asked myself same thing when I started doing the program. But my mistake was that i started writting on Visual Basic. And I had to define some functions:
------------------------------------------------------------------------------------------------------------------
Function IsPerfectSquare(x) 'it gives 1 if x is square and 0 if not.
If Sqr(x) = Math.Round(Sqr(x)) Then
IsPerfectSquare = 1
Else
IsPerfectSquare = 0
End If
End Function
Function Ceiling(x) 'gives the smallest integer, greater or equal to x
If x > Math.Round(x) Then
Ceiling = Math.Round(x) + 1
ElseIf x <= Math.Round(x) Then
Ceiling = Math.Round(x)
End Function
Function PerfectSquareCeiling(x) 'gives the smallest perfect square that is greater than x
PerfectSquareCeiling = Ceiling(Sqr(x + IsPerfectSquare(x))) ^ 2
End Function
------------------------------------------------------------------------------------------------------------------
The sum of two numbers is perfect square if
IsPerfectSquare(a+b)==1.
IPBLE: Increasing Performance By Lowering Expectations.
Offline
The third function is correct.
IPBLE: Increasing Performance By Lowering Expectations.
Offline
I know C very little.
Sorry, but I'm young and the first language i've learned was VBS.
If someone can translate the functions to C I'll be grateful.
IPBLE: Increasing Performance By Lowering Expectations.
Offline
Here's the Mathematica code:
(* PROGRAM CALCULATING THE SQUARE SUM CHAINS AND TESTING THEIR CIRCULARITY
Based on Georgiev's square sum chain creating algoritm
By Krasimir Geogiev
December, 2005 *)
(*____________________________________________________________*)
(* data *)
n := 17
k := 2
(* /data *)
(*____________________________________________________________*)
(* function defining *)
sq[x_] := If[x^(1/2) == Floor[x^(1/2)], 1, 0]
(* this function gives 1 when x is perfect square and 0 when it isn't. *)
sqcei[x_] := Ceiling[(x+sq[x])^(1/2)]^2
(* this function gives the smallest perfect square which is greater than x. *)
(* /function defining *)
(*____________________________________________________________*)
(* calculations *)
a[1] := k
Do[b[i] = 0, {i, 1, n^3}]
b[k] := 1
Do[
p = sqcei[a[i - 1]] - a[i - 1];
j = 0;
While[j == 0,
If[b[p] == 0,
b[p] = 1;
a[i] = p;
j = 1,
p = sqcei[p + a[i - 1]] - a[i - 1]
]], {i, 2, n}]
(* /calculations *)
(*____________________________________________________________*)
(* output *)
t=Table[a[i],{i,1,n}]
max = Max[t]
iscir=If[sq[a[n] + k] == 1, 1, 0]
(* /output*)
(*____________________________________________________________*)
here you choose n and k.
t is the chain
max is max number in the chain
iscir is 1 if the chain sequence is circular and 0 if not.
I've simplified the output. In my program actually it is:
(* output *)
Print["The chain:"]
t = Table[a[i], {i, 1, n}]
Print["Length:"]
n
Print["Maximal number:"]
Max[t]
Print["Graphical plot:"]
ListPlot[t, PlotJoined -> True]
isO[x_] := If[sq[a[x] + k] == 1, 1, 0]
Print["if j <= n chain is circular:"]
tt = Table[isO[i], {i, 1, n}]
Print["Graphical plot of the circular test:"]
Plot[isO[Floor[x]], {x, 1, n + 1}]
(* /output*)
IPBLE: Increasing Performance By Lowering Expectations.
Offline
I just have found something very interesting:
The biggest number in the square sum chain sq(2,17)={2, 7, 9, 16, 20, 5, 4, 12, 13, 3, 1, 8, 17, 19, 6, 10, 15} with length 17 is 20!
Unfortunately sq(2,17) is not circular.
Last edited by krassi_holmz (2005-12-29 07:40:52)
IPBLE: Increasing Performance By Lowering Expectations.
Offline
Oh. I forgot!
sq(x,y) - x means the first number in the chain, y-the length of the chain.
Last edited by krassi_holmz (2005-12-29 07:41:53)
IPBLE: Increasing Performance By Lowering Expectations.
Offline
Conjection:
The greatest number in the chain sq(1, n) is >n and ≈2n.
IPBLE: Increasing Performance By Lowering Expectations.
Offline
1 3 6 10 15 21 4 12 24 25
11 5 31 18 7 9 40 41 8
All less than fifty. Length=19
1 8 17 19 6 10 15 21 4 5
11 14 2 23 13 12 24
All less than 50, Length = 17
1 3 6 10 15 21 4 12 13 23
2 34 30 19 45 36 28 8
All less than 50, Length = 18
1 3 6 10 15 21 4 5 20 16
9 27 22 14 2 23 13 36 28 8
41 40 24
All less than 50, Length = 23
1 3 6 10 15 21 4 12 24 25
11 5 44 20 16 33 31 18 46 35
All less than 50, Length = 20
Last edited by John E. Franklin (2005-12-29 09:48:08)
igloo myrtilles fourmis
Offline
Length=25, #'s < 50
1 8 17 19 6 3 22 14 11 5
31 18 7 2 23 26 10 39 25 24
40 9 16 33 48
Length=21, #'s < 50
1 8 17 19 6 10 15 21 4 5
11 14 2 7 9 16 20 29 35 46
3
Last edited by John E. Franklin (2005-12-29 09:54:32)
igloo myrtilles fourmis
Offline
sq(3,24)={3, 1, 8, 17, 19, 6, 10, 15, 21, 4, 5, 11, 14, 2, 7, 9, 16, 20, 29, 35, 46, 18, 31, 33}
Length-24
#<50
Last edited by krassi_holmz (2005-12-29 09:59:15)
IPBLE: Increasing Performance By Lowering Expectations.
Offline
Does "correspond" mean they came out the same as yours?
Does sq(1,23) mean Length 23, starts on 1?
igloo myrtilles fourmis
Offline
Another Length 25, all #'s < 50
1 3 6 10 15 21 4 32 17 19
30 34 2 7 42 22 14 35 29 20
44 5 11 25 24
A twenty long, below 50
1 3 6 10 15 21 4 32 17 8
28 36 13 23 41 40 9 16 33 48
Last edited by John E. Franklin (2005-12-29 10:03:51)
igloo myrtilles fourmis
Offline
sq(1,23) means with length 23, tarting on 1 that is generated by my algoritm. My algoritm gives it too.
IPBLE: Increasing Performance By Lowering Expectations.
Offline
Awesome! My algorithm uses random #'s, kind of cheating.
Everytime I run, I get a different answer, usually.
a twelve long, max #21
1 8 17 19 6 10 15 21 4 12
13 3
Last edited by John E. Franklin (2005-12-29 10:07:19)
igloo myrtilles fourmis
Offline
Then you have got much luck!
IPBLE: Increasing Performance By Lowering Expectations.
Offline
Well, I pick a random square and subtract last number from it
and check if number is used yet.
Here's 22 long (my favorite #), Max#41
1 3 6 10 15 21 4 12 13 23
2 7 9 27 22 14 11 25 24 40
41 8
a 19 long, max 46
1 3 6 10 15 21 4 12 13 23
2 7 29 20 5 31 18 46 35
Last edited by John E. Franklin (2005-12-29 10:13:53)
igloo myrtilles fourmis
Offline
My longest under 50.
Length=28, Max=41
1 3 6 10 15 21 4 12 13 23
2 14 22 27 9 16 20 29 7 18
31 5 11 25 24 40 41 8
igloo myrtilles fourmis
Offline
A 28 long, MaxNumber=52(too close ):
sq(13,28)={13, 3, 1, 8, 17, 19, 6, 10, 15, 21, 4, 5, 11, 14, 2, 7, 9, 16, 20, 29, 35, 46, 18, 31, 33, 48, 52, 12}
IPBLE: Increasing Performance By Lowering Expectations.
Offline
a 9 long, max=24
1 3 6 10 15 21 4 12 24
an 11 long, max=34
1 8 17 19 6 10 26 23 2 34
15
a 14 long, max=40
1 3 6 10 15 21 4 5 31 18
7 9 40 24
a 15 long, max=36
1 3 6 10 15 21 4 32 17 8
28 36 13 12 24
Last edited by John E. Franklin (2005-12-29 10:33:36)
igloo myrtilles fourmis
Offline