mersenneforum.org  

Go Back   mersenneforum.org > Math Stuff > Computer Science & Computational Number Theory > PARI/GP

Reply
 
Thread Tools
Old 2012-07-10, 21:24   #2355
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

100101000110012 Posts
Default

It was sarcasm, man. I actually made a bet that it will go undetected.

Sarcasm is when adjectives are deliberately inverted. Example: "That movie? I simply loved* every bit of it. It is so bad that it's actually hilarious!"

____
*sarcasm detected. In plain speak, a person would say "hated it"
Batalov is offline   Reply With Quote
Old 2012-07-10, 21:39   #2356
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

100000110000002 Posts
Default

Quote:
Originally Posted by Batalov View Post
It was sarcasm, man. I actually made a bet that it will go undetected.

Sarcasm is when adjectives are deliberately inverted. Example: "That movie? I simply loved* every bit of it. It is so bad that it's actually hilarious!"

____
*sarcasm detected. In plain speak, a person would say "hated it"
maybe it went undetected because if I'm serious about things, I'm not involving sarcasm.
science_man_88 is offline   Reply With Quote
Old 2012-07-10, 23:58   #2357
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

100000110000002 Posts
Default

I can see why it might be hard to do though:

ex. 33191

Code:
? isprime(3)
%25 = 1
? isprime(331)
%26 = 1
? isprime(3319)
%27 = 1
? isprime(33191)
%28 = 1
? isprime(31)
%29 = 1
? isprime(319)
%30 = 0
? isprime(3191)
%31 = 1
? isprime(19)
%32 = 1
? isprime(191)
%33 = 1
8 primes in 5 digits so just looking for primes without looking for is this greater/less than this becomes practically impossible, even looking for greater/less than might be somewhat impossible because it could be 191 or 3191 for the high limit depending on how you break it down. so you can by eye come up with 3*3*191 or 3*3191 for it but using a computer program will get rather complex.
science_man_88 is offline   Reply With Quote
Old 2012-07-11, 03:27   #2358
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Code:
dp(n)={
  if(n<12, return(if(isprime(n), [n], [])));
  my(v=vecsort(select(isprime, eval(Vec(Str(n)))), , 8), t);
  while(n>9,
    if(gcd(n%10, 10)>1, n\=10; next);
    t=10;
    while((t*=10)<n*10,
      if(isprime(n%t), v=concat(v, n%t))
    );
    v=vecsort(v, , 8);
    n\=10
  );
  v
};
addhelp(dp, "dp(n): Distinct primes formed from substrings of n. Related to Sloane's A039997 and A093301.");
Code:
> dp(33191)
%1 = [3, 19, 31, 191, 331, 3191, 3319, 33191]
> #%
%2 = 8

Last fiddled with by CRGreathouse on 2012-07-11 at 03:28
CRGreathouse is offline   Reply With Quote
Old 2012-07-11, 11:43   #2359
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
Code:
dp(n)={
  if(n<12, return(if(isprime(n), [n], [])));
  my(v=vecsort(select(isprime, eval(Vec(Str(n)))), , 8), t);
  while(n>9,
    if(gcd(n%10, 10)>1, n\=10; next);
    t=10;
    while((t*=10)<n*10,
      if(isprime(n%t), v=concat(v, n%t))
    );
    v=vecsort(v, , 8);
    n\=10
  );
  v
};
addhelp(dp, "dp(n): Distinct primes formed from substrings of n. Related to Sloane's A039997 and A093301.");
Code:
> dp(33191)
%1 = [3, 19, 31, 191, 331, 3191, 3319, 33191]
> #%
%2 = 8
now I'm going to have to figure out which come together to form the numbers .
science_man_88 is offline   Reply With Quote
Old 2012-07-15, 17:53   #2360
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

I'll have to refocus on the backwards home prime stuff again but for some reason my brain is stuck in do things backwards mode:

Code:
reverse_collatz(n)=if(n%3==1&&((n-1)/3)%2==1,return([(n-1)/3,2*n]),return([2*n]))
science_man_88 is offline   Reply With Quote
Old 2012-07-15, 19:31   #2361
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

597910 Posts
Default

Code:
reverse_collatz(n)=if(n%6==4,[n\3,2*n],[2*n])

Last fiddled with by CRGreathouse on 2012-07-15 at 19:34
CRGreathouse is offline   Reply With Quote
Old 2012-07-15, 19:34   #2362
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
Why are you returning one-element vectors?
I clearly didn't think deep enough, maybe it would help in recall if it's mixed in with 2 element ones to check for repeating because 1,4,2,1 does exist even if you make it look for n%2==1 values.

edit: I messed up everything after 1,4,2,1 I think

Last fiddled with by science_man_88 on 2012-07-15 at 19:44
science_man_88 is offline   Reply With Quote
Old 2012-07-15, 21:25   #2363
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
Code:
reverse_collatz(n)=if(n%6==4,[n\3,2*n],[2*n])
I just looked into it using modular arithmetic how can it work because I get:

Quote:
0->0
1->2,4,0
2->4
3->0
4->1,2,3,5
5->4
going backwards if 4 mod 6 is the only way to get 1 3 and 5 mod 6 then the Collatz conjecture can't be true over all the positive numbers because the number of numbers that are 1 3 and 5 mod 6 have a total greater than the amount of 4 mod 6 .

Last fiddled with by science_man_88 on 2012-07-15 at 21:25
science_man_88 is offline   Reply With Quote
Old 2012-07-15, 21:30   #2364
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

597910 Posts
Default

If n is 1 mod 3 and (n-1)/3 is 2k+1 for some k then n-1 is 6k+3 and so n =6k+4 for some k, i.e., is 4 mod 6.
CRGreathouse is offline   Reply With Quote
Old 2012-07-15, 21:35   #2365
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

838410 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
If n is 1 mod 3 and (n-1)/3 is 2k+1 for some k then n-1 is 6k+3 and so n =6k+4 for some k, i.e., is 4 mod 6.
I get some of that and I see my error it's treating infinity as a limit and treating it like any positive number because there's no limit on the size of number to go through it can continue to stay true even with the 4 mod 6 outnumbered.
science_man_88 is offline   Reply With Quote
Reply

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

All times are UTC. The time now is 22:04.


Fri Aug 6 22:04:29 UTC 2021 up 14 days, 16:33, 1 user, load averages: 3.01, 2.83, 2.71

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, 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.