mersenneforum.org  

Go Back   mersenneforum.org > Fun Stuff > Puzzles

Reply
 
Thread Tools
Old 2010-12-13, 03:52   #122
davar55
 
davar55's Avatar
 
May 2004
New York City

2×2,099 Posts
Default

While this is current, any other mathematicians here want
to comment on whether this sequence is provably infinite?
Perhaps by a density heuristic argument?
davar55 is offline   Reply With Quote
Old 2010-12-13, 04:45   #123
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

2×2,969 Posts
Default

Quote:
Originally Posted by davar55 View Post
While this is current, any other mathematicians here want
to comment on whether this sequence is provably infinite?
Perhaps by a density heuristic argument?
It's heuristically infinite with the n-th term about 2.3n * 10^n. I doubt it can be proven infinite with present technology, but a conditional proof on the k-tuple conjecture seems plausible (though it would give bounds wildly out of proportion with the true size of the terms).
CRGreathouse is offline   Reply With Quote
Old 2010-12-13, 13:15   #124
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

836910 Posts
Default

Quote:
Originally Posted by davar55 View Post
Well, so far the sequence of sum(p^p)mod(10^n)
(I think it needs a better name) is:

11
751
1129
361649
361649
12462809
12462809
1273183931
1273183931

Any bets that the tenth and eleventh terms are equal,
and whether the twelfth breaks THAT pattern?
I don't know what you're doing obviously because all I came up with that your description could be is:

Code:
a=0;for(n=1,100,a=a+prime(n)^prime(n);print(a%(10^n)))
science_man_88 is offline   Reply With Quote
Old 2010-12-13, 13:50   #125
davar55
 
davar55's Avatar
 
May 2004
New York City

2×2,099 Posts
Default

The next step would be to filter out to only values = 0.

But I think you need a double loop.
davar55 is offline   Reply With Quote
Old 2010-12-13, 14:51   #126
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

8,369 Posts
Default

Quote:
Originally Posted by davar55 View Post
The next step would be to filter out to only values = 0.

But I think you need a double loop.
Code:
a=0;for(m=1,2,for(n=1,1000,a=a+prime(n)^prime(n);if(a%(10^m)==0,print(n":"m)));a=0)
like this ?
science_man_88 is offline   Reply With Quote
Old 2010-12-13, 16:09   #127
axn
 
axn's Avatar
 
Jun 2003

17×281 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
Five, actually -- it will be fourth and fifth on your list:

11, 751, 1129, 361649, 361649, 12462809, 12462809, 1273183931, 1273183931.

Would someone check me on these? The repeating entries are freaking me out.
Verified the first 7 terms:
11, 751, 1129, 361649, 361649, 12462809, 12462809.
axn is offline   Reply With Quote
Old 2010-12-13, 16:41   #128
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

202618 Posts
Default

with an outer loop I got 11 661 for the start.
science_man_88 is offline   Reply With Quote
Old 2010-12-13, 23:57   #129
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

2×2,969 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
Code:
a=0;for(m=1,2,for(n=1,1000,a=a+prime(n)^prime(n);if(a%(10^m)==0,print(n":"m)));a=0)
like this ?
As a rule of thumb, any time you write

for(n=1, _, ... prime(n) ...)

you should be writing

forprime(p=2, prime(_), ... p ...)

instead.
CRGreathouse is offline   Reply With Quote
Old 2010-12-14, 00:56   #130
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

8,369 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
As a rule of thumb, any time you write

for(n=1, _, ... prime(n) ...)

you should be writing

forprime(p=2, prime(_), ... p ...)

instead.
flaws:

1) isn't always faster
2) results of our codes don't line up so why improve performance of something that gives wrong supposedly inaccurate results
3) I'm already in a bad mood as my sister just called to ask for any mail for here then told me to goto the end of our driveway to check any newer mail and it's almost 9 at night then got mad when i said do I have to, because they technically shouldn't be sending anything here for her or the thing they have planned for my mom.so I'm kinda not in the caring mood.
science_man_88 is offline   Reply With Quote
Old 2010-12-14, 04:37   #131
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

10111001100102 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
3) I'm already in a bad mood as my sister just called to ask for any mail for here then told me to goto the end of our driveway to check any newer mail and it's almost 9 at night then got mad when i said do I have to, because they technically shouldn't be sending anything here for her or the thing they have planned for my mom.so I'm kinda not in the caring mood.
Well, that's what I get for trying to help improve your programming skills.

Quote:
Originally Posted by science_man_88 View Post
1) isn't always faster
It's pretty much faster in all cases. prime() is very inefficient, it typically just goes through the primes until it hits the right one.

for(n=1,10,prime(n)) goes through numbers in this order: 2, 2, 3, 2, 3, 5, 2, 3, 5, 7, 2, 3, 5, 7, 11, 2, 3, 5, 7, 11, 13, 2, 3, 5, 7, 11, 13, 17, 2, 3, 5, 7, 11, 13, 17, 19, 2, 3, 5, 7, 11, 13, 17, 19, 23, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 for a total of 10(10+1)/2 = 55 numbers. forprime(p=2,29,p) goes straight through: 2, 3, 5, 7, 11, 13, 17, 19, 23. forprime(p=2, prime(10), p) goes through the primes once to discover the tenth prime, then again for the actual loop.

Quote:
Originally Posted by science_man_88 View Post
2) results of our codes don't line up so why improve performance of something that gives wrong supposedly inaccurate results
Post an example. The only times that
Code:
forprime(p=2,prime(floor(N)), f(p))
should differ from
Code:
for(n=1,N, f(prime(n)))
are
  • When n or p are used in f (in which case you might just need to change variables!)
  • When N is not a t_INT, t_REAL, or t_FRAC, in which case both give errors, but the errors are different
  • When you run out of primes (in which case forprime tells you upfront and for() only tells you when you run out)
  • When you look at the time taken (essentially, forprime is always faster)
CRGreathouse is offline   Reply With Quote
Old 2010-12-14, 09:18   #132
NBtarheel_33
 
NBtarheel_33's Avatar
 
"Nathan"
Jul 2008
Maryland, USA

21318 Posts
Question p^2 or p^p?

Quote:
Originally Posted by davar55 View Post
Well, so far the sequence of sum(p^p)mod(10^n)
(I think it needs a better name) is:

11
751
1129
361649
361649
12462809
12462809
1273183931
1273183931

Any bets that the tenth and eleventh terms are equal,
and whether the twelfth breaks THAT pattern?
Isn't this the sum of P^2 for p prime, NOT p^p? This thread has me confused...
NBtarheel_33 is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regarding Squares a1call Miscellaneous Math 42 2017-02-03 01:29
Basic Number Theory 12: sums of two squares Nick Number Theory Discussion Group 0 2016-12-11 11:30
Integers = sums of 2s and 3s. 3.14159 Miscellaneous Math 12 2010-07-21 11:47
Sums of three squares CRGreathouse Math 6 2009-11-06 19:20
squares or not squares m_f_h Puzzles 45 2007-06-15 17:46

All times are UTC. The time now is 20:45.

Wed Nov 25 20:45:51 UTC 2020 up 76 days, 17:56, 3 users, load averages: 1.39, 1.48, 1.53

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.