![]() |
|
|
#100 | |
|
"Forget I exist"
Jul 2009
Dumbassville
100000110000002 Posts |
Quote:
Last fiddled with by science_man_88 on 2012-03-23 at 19:18 |
|
|
|
|
|
|
#101 | |
|
"Forget I exist"
Jul 2009
Dumbassville
838410 Posts |
Quote:
1)if sorted version of vectors are equal 2)if first sorted vector's first value is less than any value after second sorted vector's 3rd element are the main things I was trying to implement: Code:
(e)->j=0;
k=1;
a=vector(3,b,vecsort(vector(6,b,d=0;until(d>0,d=random(e+1));d),,4));
for(f=1,3,
for(g=
if(f==1,2,
if(f==2,3,
if(f==3,1
)
)
),
if(f==1,2,
if(f==2,3,
if(f==3,1
)
)
),
if(vecsort(a[f],,4)==vecsort(a[g],,4)
|| vecsort(a[f],,4)[1]<vecsort(a[g],,4)[6]
|| vecsort(a[f],,4)[1]<vecsort(a[g],,4)[5]
|| vecsort(a[f],,4)[1]<vecsort(a[g],,4)[4]
|| vecsort(a[f],,4)[1]<vecsort(a[g],,4[3]
,next(2)
)
);
for(h=1,6,
for(i=k,6,
if(a[f][h]<a[g][i],
k=k+1,
j=j+k*(e-h)
)
)
);
if((j/(e^2))>.5,
,
return(0)
);
j=0;
k=1
);
return(1)
Last fiddled with by science_man_88 on 2012-03-24 at 18:45 |
|
|
|
|
|
|
#102 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Quote:
|
|
|
|
|
|
|
#103 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
|
|
|
|
|
|
#104 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
what are you down to now ? if I did everything properly ( addmitedly I haven't found a way to do: "The sets of dice {A,B,C}, {B,C,A} and {C,A,B} are the same set." or a way to make sure they are all unique but even testing what I believe could be N^18 possibilities ( admittedly likely a lot less) I think I'm down to just over 2300 years. oh never mind that was my N=7 result.
Last fiddled with by science_man_88 on 2012-03-25 at 01:57 |
|
|
|
|
|
#105 |
|
Oct 2007
Manchester, UK
23·59 Posts |
Here is a fairly ginormous hint:
Perhaps you should look at how you could generate all combinations of two digits, remember that for a combination, the order they are in doesn't matter. eg. 19 OR 91, but not both, they are counted as the same combination, "a 1 and a 9". If you count all the valid combinations, how many are there? [url=http://en.wikipedia.org/wiki/Triangular_number]Hint[/url]. How about combinations of 3 digits, how many combinations are there now? [url=http://en.wikipedia.org/wiki/Tetrahedral_numbers]Hint[/url]. Try this with various ranges of numbers, 1 to 2, 1 to 3 etc. Now generalise it to 6 "digits" (or "sides of a die" in our case), and use 1 to 30 as your single digit range (if you can allow yourself to think of 30 as a single digit, just pretend you're working in base 31 or higher). Now you can generate all combinations of a die without repeats and in numerical order. If you don't get the trick right away, that's fine, but think about it for a couple of days. If you can't initially write down code to generate 2 or 3 digit combos, just work them out on pen and paper until you see a pattern, if you restrict yourself to a digit range of 1 to 4 or similar, there aren't that many. If you get stuck at some point and have questions, then as a general rule don't immediately post them. Wait a while and you might discover the answers yourself. Similarly if you work something out, don't post it immediately, work out as much as you can then post everything together at the end, it's much easier to read that way. |
|
|
|
|
|
#106 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Quote:
Code:
Euler376(e)=j=0;k=0;a=vector(3,b,vecsort(vector(6,b,d=0;until(d>0,d=random(e+1));d),,4));for(f=1,3,for(g=if(f==1,2,if(f==2,3,if(f==3,1))),if(f==1,2,if(f==2,3,if(f==3,1))),if(vecsort(a[f],,4)==vecsort(a[g],,4),return(0),if(vecsort(a[f],,4)[1]<vecsort(a[g],,4)[3],j=18));for(h=1,6,for(i=if(j==18,4,1),6,if(a[f][h]<a[g][i],k=k+1;if((k+j)>18,return(1)),j=j+k*(e-h))));if(j<=18,,return(0)));j=0;k=0);return(1) Last fiddled with by science_man_88 on 2012-03-25 at 12:26 |
|
|
|
|
|
|
#107 |
|
Oct 2007
Manchester, UK
25158 Posts |
|
|
|
|
|
|
#108 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
yeah I'm looking at 377 for now I'll get back 376 some time. I've already got a script for what they seem to mean already except I've never heard digital sum used that way ( or at least not for just those types of numbers).
|
|
|
|
|
|
#109 |
|
Feb 2012
67 Posts |
377 is hilarious
there is an OEIS sequence but it's incorrect |
|
|
|
|
|
#110 | |
|
"Forget I exist"
Jul 2009
Dumbassville
838410 Posts |
Quote:
Code:
(n)->d=0;forstep(x=n,(10^n-1)/9,9,if(vecsort(eval(Vec(Str(x))),,8)[1]==0,next(1),if(sum(X=1,#vecsort(eval(Vec(Str(x))),,4),vecsort(eval(Vec(Str(x))),,4)[X])==n,d=d+x)));d Code:
(n)->b=0;a=Vec(select(v->vecmin(v)>0,partitions(n)));for(x=1,#a-1,b=b+((10^#a[x]-1)/9)*n);for(v=1,#a[#a],b=b+a[#a][v]*10^(#a[#a]-v));b |
|
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Project Euler | jhs | Puzzles | 32 | 2021-01-19 04:05 |
| Project Euler 486 | lavalamp | Puzzles | 8 | 2015-02-04 14:28 |
| Euler (6,2,5) details. | Death | Math | 10 | 2011-08-03 13:49 |
| Project Euler | Mini-Geek | Lounge | 2 | 2009-10-23 17:19 |
| Bernoulli and Euler numbers (Sam Wagstaff project) | fivemack | Factoring | 4 | 2008-02-24 00:39 |