![]() |
|
|
#441 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
they both work until M(1) but after that they climb to 35 and 70 for the next ones.
Last fiddled with by science_man_88 on 2010-08-14 at 18:03 |
|
|
|
|
|
#442 | |
|
"Forget I exist"
Jul 2009
Dumbassville
203008 Posts |
Quote:
http://www.mersenneforum.org/cgi-bin...1}M(n)%20+%20x Last fiddled with by science_man_88 on 2010-08-14 at 18:06 |
|
|
|
|
|
|
#443 |
|
Aug 2006
3·1,993 Posts |
Is x in the sum or out of the sum?
|
|
|
|
|
|
#444 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
out I know I wasn't sure how to make it obvious. sum all M(n) less than M(x) then add x to that sum.
I realize it should of been first now lol. Last fiddled with by science_man_88 on 2010-08-14 at 18:29 |
|
|
|
|
|
#445 |
|
Aug 2006
10111010110112 Posts |
Code:
M(x)=x+sum(n=0,x-1,M(n)) Here's a solution with memoization. It stores the values rather than recalculating: Code:
M(x)={
if(x < 1, return(0));
if(Mvec == 'Mvec,Mvec=[]);
if(#Mvec < x,
my(n=#Mvec);
Mvec=vector(x,i,if(i<=n,Mvec[i]));
for(i=n+1,x, Mvec[i]=i+sum(j=1,i-1,Mvec[j]))
);
Mvec[x]
};
Code:
M(x)=(1<<x)-1 |
|
|
|
|
|
#446 | |
|
"Forget I exist"
Jul 2009
Dumbassville
20C016 Posts |
Quote:
|
|
|
|
|
|
|
#447 |
|
Aug 2006
3×1,993 Posts |
No, memoization and memoize. Different words.
Not sure what you mean. |
|
|
|
|
|
#448 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
is there a similar formula for the sequences that hold super-perfect and perfect numbers respectively? Last fiddled with by science_man_88 on 2010-08-14 at 18:51 |
|
|
|
|
|
#449 | |
|
Aug 2006
3·1,993 Posts |
Quote:
|
|
|
|
|
|
|
#450 |
|
Jun 2003
508710 Posts |
|
|
|
|
|
|
#451 | |
|
Aug 2006
135338 Posts |
Quote:
|
|
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Why do I sometimes see all the <> formatting commands when I quote or edit? | cheesehead | Forum Feedback | 3 | 2013-05-25 12:56 |
| Passing commands to PARI on Windows | James Heinrich | Software | 2 | 2012-05-13 19:19 |
| Ubiquity commands | Mini-Geek | Aliquot Sequences | 1 | 2009-09-22 19:33 |
| 64-bit Pari? | CRGreathouse | Software | 2 | 2009-03-13 04:22 |
| Are these commands correct? | jasong | Linux | 2 | 2007-10-18 23:40 |