mersenneforum.org  

Go Back   mersenneforum.org > Fun Stuff > Puzzles

Reply
 
Thread Tools
Old 2011-02-07, 17:56   #1
Flatlander
I quite division it
 
Flatlander's Avatar
 
"Chris"
Feb 2005
England

40358 Posts
Default Primes from powers of 2 strings.

Create primes by arranging the strings produced from progressive powers of 2 from 2^0 to 2^n. i.e.

A prime using the string "1", none.
A prime using the strings "2" and"1", none.
A prime using the strings "4", "2" and "1", 421 or 241.
etc.

No taking parts of strings.
All strings from 1 to your chosen n must be used.

What is the largest prime you can make?
The largest prime for the strings in order or near order, near reverse etc?
The largest prime that is also a twin (+2 or -2) or has other interesting properties?
Kudos for posting small, efficient code.

If this is known or on OEIS create a similar more interesting puzzle!
Flatlander is offline   Reply With Quote
Old 2011-02-07, 18:50   #2
nuggetprime
 
nuggetprime's Avatar
 
Mar 2007
Austria

30210 Posts
Default

How about this small little PARI-GP function:
Code:
for(z=1,100,y=2^z;for(x=1,z-1,y*=10^(ceil(log(2)*(z-x)/log(10)));y+=2^(z-x));y*=10;y++;write("cand_puzzle.txt",y))
writes candidates into cand_puzzle.txt like this
z(1)=21
z(2)=421
z(3)=8421...
upto z=100.(you can ofcourse go further if you want)

Then pump the output into PFGW and hopefully I'll find something!
nuggetprime is offline   Reply With Quote
Old 2011-02-07, 19:10   #3
petrw1
1976 Toyota Corona years forever!
 
petrw1's Avatar
 
"Wayne"
Nov 2006
Saskatchewan, Canada

4,373 Posts
Default

Quote:
Originally Posted by Flatlander View Post
Create primes by arranging the strings produced from progressive powers of 2 from 2^0 to 2^n. i.e.

A prime using the string "1", none.
A prime using the strings "2" and"1", none.
A prime using the strings "4", "2" and "1", 421 or 241.
etc.

No taking parts of strings.
All strings from 1 to your chosen n must be used.

What is the largest prime you can make?
The largest prime for the strings in order or near order, near reverse etc?
The largest prime that is also a twin (+2 or -2) or has other interesting properties?
Kudos for posting small, efficient code.

If this is known or on OEIS create a similar more interesting puzzle!
I assume the "strings" need to be kept intact?
i.e. in 1,2,4,8,16,32 --- the 16 and the 32 can't be split as in 41823621?

It "appears" that every second string starting with 1,2 add up to a multiple of 3 and so CANNOT be prime.
petrw1 is online now   Reply With Quote
Old 2011-02-07, 20:25   #4
axn
 
axn's Avatar
 
Jun 2003

13·192 Posts
Default

Quote:
Originally Posted by petrw1 View Post
It "appears" that every second string starting with 1,2 add up to a multiple of 3 and so CANNOT be prime.
Basic restrictions -- all powers of two end in an even digit except 1. So only permutations ending in 1 has a chance of being prime. Also, for even n, the sum of digits of 2^0 .. 2^n is divisible by 3. So only odd 'n' has a chance of yielding primes.
axn is online now   Reply With Quote
Old 2011-02-07, 20:56   #5
Flatlander
I quite division it
 
Flatlander's Avatar
 
"Chris"
Feb 2005
England

31×67 Posts
Default

Quote:
Originally Posted by petrw1 View Post
I assume the "strings" need to be kept intact?
...
Yes.
Flatlander is offline   Reply With Quote
Old 2011-02-08, 11:26   #6
Merfighters
 
Merfighters's Avatar
 
Mar 2010
On front of my laptop

7×17 Posts
Default

220 digits
Code:
8589934592838860881928687194767366710886465536645368709125242885124294967296419430440964343597383683355443232768322684354562621442562147483648209715220482171798691841677721616384161342177281310721048576107374182410241281
 
8589934592_8388608_8192_8_68719476736_67108864_65536_64_536870912_524288_512_4294967296_4194304_4096_4_34359738368_33554432_32768_32_268435456_262144_256_2147483648_2097152_2048_2_17179869184_16777216_16384_16_134217728_131072_1048576_1073741824_1024_128_1
Merfighters is offline   Reply With Quote
Old 2011-02-08, 15:28   #7
Flatlander
I quite division it
 
Flatlander's Avatar
 
"Chris"
Feb 2005
England

1000000111012 Posts
Default

Very nice. How did you find it?
Flatlander is offline   Reply With Quote
Old 2011-02-08, 16:17   #8
nuggetprime
 
nuggetprime's Avatar
 
Mar 2007
Austria

2×151 Posts
Default

Quote:
Originally Posted by nuggetprime View Post
How about this small little PARI-GP function:
Code:
for(z=1,100,y=2^z;for(x=1,z-1,y*=10^(ceil(log(2)*(z-x)/log(10)));y+=2^(z-x));y*=10;y++;write("cand_puzzle.txt",y))
writes candidates into cand_puzzle.txt like this
z(1)=21
z(2)=421
z(3)=8421...
upto z=100.(you can ofcourse go further if you want)

Then pump the output into PFGW and hopefully I'll find something!
Tested upto ca.10000 digits-no primes.
Will try another orientation and hopefully I can beat the 220 digit record!
nuggetprime is offline   Reply With Quote
Old 2011-02-08, 19:49   #9
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

134378 Posts
Default

I have a 1224-digit prime using the powers of 2^0 to 2^88:
Code:
309485009821345068724781056154742504910672534362390528773712524553362671811952643868562622766813359059763219342813113834066795298816967140655691703339764940848357032784585166988247042417851639229258349412352120892581961462917470617660446290980731458735308830223145490365729367654415111572745182864683827275557863725914323419136377789318629571617095681888946593147858085478494447329657392904273924722366482869645213696236118324143482260684811805916207174113034245902958103587056517122951479051793528258561475739525896764129287378697629483820646436893488147419103232184467440737095516169223372036854775808461168601842738790423058430092136939521152921504606846976576460752303423488288230376151711744144115188075855872720575940379279363602879701896396818014398509481984900719925474099245035996273704962251799813685248112589990684262456294995342131228147497671065614073748835532870368744177664351843720888321759218604441687960930222084398046511104219902325555210995116277765497558138882748779069441374389534726871947673634359738368171798691848589934592429496729621474836481073741824536870912268435456134217728671088643355443216777216838860841943042097152104857652428826214413107265536327681638481924096204810245122561281632864421
CRGreathouse is offline   Reply With Quote
Old 2011-02-08, 23:55   #10
R.D. Silverman
 
R.D. Silverman's Avatar
 
Nov 2003

746010 Posts
Default

Quote:
Originally Posted by Flatlander View Post
Create primes by arranging the strings produced from progressive powers of 2 from 2^0 to 2^n. i.e.

A prime using the string "1", none.
A prime using the strings "2" and"1", none.
A prime using the strings "4", "2" and "1", 421 or 241.
etc.

No taking parts of strings.
All strings from 1 to your chosen n must be used.
Are duplicates allowed; e.g. 4421?

Using your rules, I expect only finitely many; the numbers grow too
fast.
R.D. Silverman is offline   Reply With Quote
Old 2011-02-09, 00:01   #11
Flatlander
I quite division it
 
Flatlander's Avatar
 
"Chris"
Feb 2005
England

40358 Posts
Default

Quote:
Originally Posted by R.D. Silverman View Post
Are duplicates allowed; e.g. 4421?

Using your rules, I expect only finitely many; the numbers grow too
fast.
No duplicates for this puzzle. I assumed there would be too many primes if things weren't restricted.
Flatlander is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Digit strings containing primes davar55 Puzzles 13 2018-03-15 14:46
Sieving with powers of small primes in the Small Prime variation of the Quadratic Sieve mickfrancis Factoring 2 2016-05-06 08:13
Bashing Strings Parsimoniously in Linux EdH Programming 15 2013-05-06 11:04
ubasic question - strings Andi47 Programming 5 2008-12-28 05:52
Strings of Digits davar55 Puzzles 5 2008-11-02 00:08

All times are UTC. The time now is 06:32.

Fri Sep 18 06:32:25 UTC 2020 up 8 days, 3:43, 0 users, load averages: 1.35, 1.49, 1.44

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.