This site is supported by donations to The OEIS Foundation.

User talk:M. F. Hasler/drafts

From OeisWiki
Jump to: navigation, search

Here are some drafts - to be submitted when OEIS goes "open" again. See also my page User:M. F. Hasler/Work in progress. (edit sect.0)

New sequences

%N Numbers such that 2-3n/sigma(n) is a power of 2

(PARI) for(i=1,9999999, numerator(t=2-3*i/sigma(i))==1|next;t>>valuation(t,2)==1|next;print1(i", "))

%S 6, 14, 15, 21, 28, 62, 120, 254, 496, 672, 1023, 8128, 16382, 180213, 262142, 523776, 1048574, 1796165, 3112865,

      • last result computed in ~ 1 min
COMMENTS

The sequence contains perfect numbers for which 3n/sigma(n) = 3/2 and 2-... = 1/2, and triperfect numbers for which 2-3n/sigma(n) = 1.

Odd terms are relevant for solutions to sigma(x)-sigma(x') = 3(x-x') of the form x = 2^k p n ; x' = 2^k' p' n.

M. F. Hasler 19:37, 28 December 2009 (UTC-0400)

prime chains

following Broadhurst et al on http://groups.yahoo.com/group/primenumbers/, I consider the length of chains of primes obtained by iterating p -> a*p + b, i.e.

chainlen(p,a,b) = for(c=1,1e9, ispseudoprime(p=a*p+b) | return(c))

For a systematic approach, I consider the sequence a(n) = firstchainlen( prime(n) ) where firstchainlen( p ) is the chainlen(p,a,b) for the least even a and odd b<a such that ap+b is prime:

firstchainlen(p)=forstep(a=2,1e9,2, forstep(b=1,a,2, ispseudoprime(a*p+b) & return(chainlen(p,a,b))))

I get: (now A181696): 5, 2, 4, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 4, 2, 4, 2, 2, 2, 6, 2, 4, 2, 2, 4, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 5, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 5, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 3, 2, 2, 3, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 4, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 3, 3, 4, 3, 2, 2, ...

  • Records:

? m=0; forprime(p=1,default(primelimit), forstep(a=2,1e9,2,forstep(b=1,a,2, chainlen(p,a,b)>m | next; print1(m=chainlen(p,a,b),", ")))) 5, 6, 7, 8, ^C

? m=0; forprime(p=1,default(primelimit), forstep(a=2,1e9,2,forstep(b=1,a,2, chainlen(p,a,b)>m | next; m=chainlen(p,a,b); print1(a,", ")))) 2, 30, 34, 614, ^C

? m=0; forprime(p=1,default(primelimit), forstep(a=2,1e9,2,forstep(b=1,a,2, chainlen(p,a,b)>m | next; m=chainlen(p,a,b); print1(b,", ")))) 1, 13, 33, 531, ^C

  • standard Cunnigham lengths : now oeis.org/A181697

? m=0; forprime(p=1,999,print1(chainlen(p,2,1)", ")) 5, 2, 4, 1, 3, 1, 1, 1, 2, 2, 1, 1, 3, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 6, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 5, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1,

The above are C-chains of 1st type, while x->2x-1 yieds those of 2nd type, cf. oeis.org/A181715.


COMMENTS / CORRECTIONS to existing sequences

A023806 Xenodromes: all digits in base 12 are different.

FIXME

this seq. should not have offet = 0

COMMENT

%C A023806 Except for the initial 0, the first digit must be nonzero (=> 11 choices) and subsequent digits different from the preceding ones, thus 11 choices (including '0') for the 2nd digit, 10 for the third, 9 for the 4th, &c. Thus the sequence contains

N = 1 + 11 + 11*11 + 11^2*10 + 11^2*10*9 +...+11^2*10*9*8*...*1
 = 12 + 11 * (11 + 11*10 + 11*10*9 + 11*10*9*8 + ... + 11*10*...*2*1) 
 = 12 + 11 * 11! * (1/10! + 1/9! +...+ 1/1!) = 754471433 terms.

The largest term in this sequence is a(N) = sum(i=1,11, i*12^i) = 8842413667692.

The complement of this sequence starts 13,26,39,52,65,78,91,104,117,130,143,144,145,... (after 11 multiples of 12+1, there are the excluded terms (all written in base 12) 100[12], 101[12], 110[12]...11B[12], 122[12], 133[12], ... 1BB[12], 200, 202, 212, 220...22B[12], ...).

missing XREF

M. F. Hasler 00:35, 29 December 2009 (UTC)

A011760 Elevator buttons in U.S.A.

COMMENT

a(n) = n+1 for all n>12, a(n)=n else.

The sequence should have keyword fini, since for physical reasons (total mass of the universe...) there cannot be infinitely many buttons in any elevator on earth.

missing XREF

  • A023806 (Xenodromes: all digits in base 12 are different),
  • A113763 (Non-multiples of (12+1), or numbers not divisible by (12+1)).

M. F. Hasler 00:55, 29 December 2009 (UTC)

A065496 Numbers n such that sigma(n) is a nontrivial power a^b (a,b > 1)

(PARI)

for(n=1,1e4,ispower(sigma(i)) && print1(i","))

M. F. Hasler 02:35, 29 December 2009 (UTC)

decadal prime triplets

see drafts/Decadal primes triplets.

Pandigital primes in various bases

see drafts/Pandigital_primes.

lucky numbers

unoptimized PARI code for lucky numbers:

luckies(L=1000)=my(v=vector(L\2,i,2*i-1));for(i=2,#v,v[i]>#v&break;v=vecextract(v,2^#v-1-sum(k=1,#v\v[i],2^(v[i]*k-1))));v

primes dividing all cyclic permutations of some Sm(n)=123...{n-1}{n}

Reference: http://oeis.org/draft/A180346

 isa(p,n)=my(L=#Str(n=eval(concat(vector(n,i,Str(i)))))-1);n%p&return;for(k=1,L,(n=[1,10^L]*divrem(n,10))%p&return);1
gp > isa(37,21)
%36 = 1
gp > isa(37,23)

It is clear that 2 cannot be such a number, since "every other" cyclic perm is odd. OTOH, 3 is works with every n such that Sm(n) has digitsum multiple of 3, starting with n=2:

forprime(p=3,99,for(n=1,1e9,isa(p,n)|next;print1(n",");break))
2,  *** break

We notice that 5 won't work either (which is also obvious).

forprime(p=7,99,for(n=1,1e9,isa(p,n)|next;print1(n",");break))
100,106,120,196,102,542,400,181,21,216,372,
 ***   user interrupt after 11,030 ms.

It seems almost as if there was such an n for all primes p. The least one missing in

A180346=[3, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 53, 61, 67, 73, 83, 97, 101, 107, 127, 163]

(except 2, 5) is 47:

forprime(p=2,127,setsearch(Set(S),p)|print1(p", "))
2, 5, 47, 59, 71, 79, 89, 103, 109, 113,

The following has been submitted ; changing MIN to 1 and MAX to 9999 it computes oeis:A181373

(PARI) isA180346(p,MAX=999,MIN=100)={ isprime(p) & p!=2 & p!=5 & for(n=MIN,MAX,
my(S=eval(concat(vector(n,i,Str(i)))),L=#Str(S)-1); S%p & next; for(k=1,L,
(S=[1,10^L]*divrem(S,10))%p & next(2));return(n)) }
/* returns the least corresponding n or 0 if not in this sequence */

M. F. Hasler 02:21, 24 January 2011 (UTC)

exp(sqrt(n) π) close to integers

Via A019296 = Values of n for which exp(sqrt(n) pi) is very close to an integer, where "very close" = to 0.01: I think it would be better (a) to use smaller "espilon"; (b) to use "relative error". Below, (a) is done, not (b):

gp> for(n=1,9e9,abs(frac(exp(Pi*sqrt(n)))-.5)>.499&&print1(round(exp(sqrt(n)*Pi))","))
6635624,199148648,884736744,24591257752,147197952744,545518122090,39660184000219160, 
262537412640768744,604729957825300084760,21667237292024856735768,5767026656011479534880952421,
6728629394455238601171185703,12423061195029318078959446980,13407231240799262662803980567,
gp> for(n=1,9e9,abs(frac(exp(Pi*sqrt(n)))-.5)>.4999&&print1(round(exp(sqrt(n)*Pi))","))
199148648,24591257752,147197952744,262537412640768744,604729957825300084760,5767026656011479534880952421,
6728629394455238601171185703,12423061195029318078959446980,13407231240799262662803980567,

M. F. Hasler 23:49, 26 January 2014 (UTC)

non-working (?) code for A076730

(PARI)
a(n,debug=0,m=0)={n--||return(1); my(t=vector(n,i,10^(n-i))~,o);
debug&print1(t); for(i1=1,9,o=i1*[10,10]; debug&&print1([o,n]);
forvec(d=vector(n,j,[0,9]+(j==1)*o), debug&&print1(d",");
A039993(d*t)>m||next;m=A039993(d*t);debug&&print1([m,d*t]),1));m} \\ _M. F. Hasler_, Mar 09 2014

A031877: nontrivial multiples of their reversal

A031877 = Nontrivial reversal numbers : integer multiples of their reversals, excluding palindromic numbers and multiples of 10.

[d=4] 8712, 9801,     [d=5] 87912, 98901,         
[d=6] 879912, 989901, [d=7] 8799912, 9899901,                     
[d=8] 87128712, 87999912, 98019801, 98999901,
[d=9] 871208712, 879999912, 980109801, 989999901,
[d=10] 8712008712, 8791287912, 8799999912, 9801009801, 9890198901, 9899999901,
[d=11] 87120008712, 87912087912, 87999999912, 98010009801, 98901098901, 98999999901, ...

For each d>=4, the terms

 v(d) = 88*(10^(d-2)-1)         = 879{d-4}12 (= 8712, 87912, 879912, 8799912,...)

and

 z(d) = 99*(10^(d-2)-1)         = 989{d-4}01

are solutions.

For d>=8,

u(d) = 8712*(10^(d-4)+1)   = 87120{d-8}8712 (= 87128712, 871208712, 8712008712, 87120008712, ...)

and

x(d) = 9801*(10^(d-4)+1)   = 98010{d-8}9801 (= 98019801, 980109801, 9801009801, ...)

are also (additional) solutions.

For d>=10, 9's can be inserted after 2nd and before 2nd last digit, in all of these.

More generally, all terms are of this form: Take any number of copies of either 8712, or 9801, insert any number of 0's between these copies, in a symmetrical way (e.g. the number of 0's following the 4th digit must equal the number of 0's preceding the 4 last digits), and insert any number of 9's in the middle of these 4-digit strings, again in a symmetrical way. For example, chosing 8712, five copies, 3 "0"s after the first and 4 "0"s after the second copy and 2 "9"s in the middle of the first and 1 "9" in the middle of the second and 3 "9"s in the middle of the third, we get:

87 99 12 000 87 9 12 0000 87 999 12 0000 87 9 12 000 87 99 12

Thus, the set of terms in this sequence is in bijection with {1,2} x ( N ∪ N^2 ∪ N^3 ... ) where (2,x) means 879{x}12 ; (1,x,y) means 989{x}010{y}989{x}01 ; etc.

/Polyominoes

Motivated by SeqFan message http://list.seqfan.eu/pipermail/seqfan/2014-August/013513.html

I submitted the list of (fixed) polyominoes, (see drafts/Polyominoes for more details, PARI code...)

A246533 = (0, 1, 3, 5, 7, 11, 19, 21, 22, 37, 15, 23, 27, 30, 39, 53, 54, 75, 139, 147, 149, 150, 156, 275, 277, 278, 293, 306, 549, 31,...) = List of fixed polyominoes in binary coding, ordered by number of bits, then value of the binary code. Can be read as irregular table with row lengths A001168.

and removing rotationally equivalents,

A246559 = List of one-sided polyominoes in binary coding, ordered by number of bits, then value of the binary code. Can be read as irregular table with row lengths A000988.

[0] : the (empty) 0-omino
[1] : the monomino "."
[3] : the domino ".." -- note that ":" is rotationally equivalent
[7, 11] : the triominoes ":." and "..."
[15, 23, 27, 30, 39, 54, 75] : the 7 one-sided tetrominoes ":..", "::", ".:.", "*:.", reflected skew and L, "...."
[31, 47, 55, 62, 79, 91, 94, 143, 181, 182, 188, 203, 286, 314, 406, 551, 566, 1099] : the 18 pentominoes
...

and, by also removing mirror-symmetric: (e.g., one L and one skew 4-omino)

A246521 = (0; 1; 3; 7, 11; 15, 23, 27, 30, 75; 31,...) = List of free polyominoes in binary coding, ordered by number of bits, then value of the binary code. Can be read as irregular table with row lengths A000105.