This site is supported by donations to The OEIS Foundation.

User:Ruud H.G. van Tol

From OeisWiki
Jump to: navigation, search

Math and Software Engineering go great together.

<oeis author search> <oeis edit search>

For contact, <wiki-email-this-user>, or use the <seqfan> mailing list.

The other square wave (youtube)

Brainfood for 2023

Extra dimensions are with us at every moment. When you count 20 apples in an apple tree, that number 20 is a model, and a snapshot. Each apple is an ever-changing individual, so calling them 20 apples, is presumptuous. The 21st apple is on its way, an old apple might be falling off. Soundbite: "integers are a hoax".

Make a drawing of the apple tree, and mark each apple with a number, in a different font. Make sure to skip a number. And of course name it "This is not an apple tree".

Also be aware that complex numbers are two-dimensional, with one linear and one circular dimension, so are already a small step in this general direction.

Also be aware that logarithms show that addition and multiplication, when isolated, are the same thing, but that their combination (like in 3x+1) are a different beast altogether.

Related: Where Are All The Hidden Dimensions? (youtube)

To do

  • eat, sleep, work, play

See /Todo.

Collatz

See /Collatz.

Spirals, lattice path lengths

slp( D= 2, F2= 15, P0= prime(1) )= {
  my ( N= 2^F2, v= vector(D), p0= P0, m= 0 );
  for( i= 1, N
  , my( p1= prime(i), j= (i-1)%D+1, d= if( (i-1)%(2*D) < D, p1-p0, p0-p1 ) );
    p0= p1;
    v[j]+= d;
    my( v= vecsum(abs(v)) );
    if( i <= 40, print1(v, ", ") );
    if( m < v, m= v);
  );
  [ N, m, round(N/m) ]
}

? slp(2,,0)
2, 3, 1, 1, 5, 5, 1, 1, 5, 9, 7, 3, 7, 7, 3, 7, 13, 11, 5, 9, 11, 5, 1, 7, 15, 11, 9, 13, 15, 11, 9, 13, 7, 5, 15, 17, 11, 5, 9, 15, 
cpu time = 116 ms, real time = 118 ms.
% [32768, 2035, 16]

? slp(2)
0, 1, 3, 3, 3, 3, 3, 3, 3, 7, 5, 1, 5, 5, 1, 5, 11, 9, 3, 7, 9, 3, 3, 9, 13, 9, 7, 11, 13, 9, 11, 15, 9, 7, 17, 19, 13, 7, 11, 17, 
cpu time = 115 ms, real time = 116 ms.
% [32768, 2033, 16]

? slp(3,,0)
2, 3, 5, 3, 5, 3, 7, 5, 9, 7, 9, 7, 7, 5, 5, 7, 13, 11, 9, 5, 7, 9, 13, 15, 15, 11, 9, 5, 7, 11, 25, 21, 15, 13, 23, 25, 31, 25, 25, 19, 
cpu time = 116 ms, real time = 116 ms.
% [32768, 3225, 10]

? slp(3)
0, 1, 3, 5, 7, 5, 5, 3, 7, 9, 11, 9, 5, 3, 3, 9, 15, 13, 7, 3, 5, 11, 15, 17, 13, 9, 7, 7, 9, 13, 23, 19, 13, 11, 21, 23, 29, 23, 23, 17, 
cpu time = 114 ms, real time = 115 ms.
% [32768, 3227, 10]

 

On the Stern sequence, Ruler sequence, integer factoring

Cf. A000265, A001511, A002487, A007306.

_n|_x|_2^k*_o_-1_|_2^k*_o_+1_|_c1_+_c2_=__c_|
 0| 1| 2^1    -1 |           |  1 +  0 =  1 |
 1| 3| 2^2* 1 -1 | 2^1* 1 +1 |  1 +  1 =  2 |
 2| 5| 2^1* 3 -1 | 2^2* 1 +1 |  2 +  1 =  3 |
 3| 7| 2^3* 1 -1 | 2^1* 3 +1 |  1 +  2 =  3 |
 4| 9| 2^1* 5 -1 | 2^3* 1 +1 |  3 +  1 =  4 |
 5|11| 2^2* 3 -1 | 2^1* 5 +1 |  2 +  3 =  5 |
 6|13| 2^1* 7 -1 | 2^2* 3 +1 |  3 +  2 =  5 |
 7|15| 2^4* 1 -1 | 2^1* 7 +1 |  1 +  3 =  4 |
 8|17| 2^1* 9 -1 | 2^4* 1 +1 |  4 +  1 =  5 |
 9|19| 2^2* 5 -1 | 2^1* 9 +1 |  3 +  4 =  7 |
10|21| 2^1*11 -1 | 2^2* 5 +1 |  5 +  3 =  8 |
11|23| 2^3* 3 -1 | 2^1*11 +1 |  2 +  5 =  7 |
12|25| 2^1*13 -1 | 2^3* 3 +1 |  5 +  2 =  7 |
13|27| 2^2* 7 -1 | 2^1*13 +1 |  3 +  5 =  8 |
...

Drawing:
3 = { 2^2*1-1, 2^1*1+1 }, which can be represented by vectors [2,-1] and [1,+1].
5 = { 2^1*(3)-1,                        2^2*1+1 }
  = { 2^1*(2^2*1-1)-1, 2^1*(2^1*1+1)-1, 2^2*1+1 },
or as vectors: [2,-1]+[1,-1] = [3,-2], [1,+1]+[1,-1] = [2, 0] and [2,+1].

To draw 3*5 = 15 by vector addition of 3 and 5, there are 2*3 = 6 ways:
a. [2,-1] + [3,-2] = [5,-3];
b. [2,-1] + [2, 0] = [4,-1];
c. [2,-1] + [2,+1] = [4, 0];
d. [1,+1] + [3,-2] = [4,-1];
e. [1,+1] + [2, 0] = [3,+1];
f. [1,+1] + [2,+1] = [3,+2].

Value 15 itself has 4 distinct ways (see column 'c'), and has no dependency on 5.
15 = { 2^4*1-1, 2^1*(7)+1 }
   = { 2^4*1-1, 2^1*(2^3*1-1)+1, 2^1*(2^1*(3)+1)+1 }
   = { 2^4*1-1, 2^1*(2^3*1-1)+1, 2^1*(2^1*(2^2*1-1)+1)+1, 2^1*(2^1*(2^1*1+1)+1)+1 },
or as vectors: [4,-1], [4, 0], [4,+1] and [3,+2].

From the 6 ways, those appear to match b,c,d,f. The [4,+1] has no match.

(this is all just a brain fart, so beware of typos in the above)
 

On A001011(4) (stamp strip folding)

A001011 a4.svg

On Regular Numbers

Wikipedia Regular number

See also: A353385.

Here I will explore the formula

    Ord(2^i * 3^j * 5^k) = i * j * k + ... + Ord(2^i) + Ord(3^j) + Ord(5^k) - 3 + 1.

Or: Ord(n) = f_2_3_5(i,j,k) for n = 2^i * 3^j * 5^k. (A051037: 5-smooth numbers)
 

3-smooth

The 3-smooth numbers (A003586),
starting with the powers of 2 (A000079).

  i|___0___1___2___3___4___5___6___7_
2^i|   1   2   4   8  16  32  64 128  <==
  n|   1   2   3   4   5   6   7   8
(so j=0)

In the 3-smooth sense, this is the (3^0) "rib".

Formula: Ord(2^i) = i + 1.
Example: Ord(2^6=64) = 6 + 1 = 7.


Adding the higher powers-of-3, with terms up to 3^5 (243),
with border lines per power of 3:

j\i___0____1____2____3____4____5____6____7_
0|*___1____2/___4____8/__16/__32___64/=128/
1|____3____6/__12___24/__48/==96==192/
2|____9___18/__36___72/=144/
3|___27___54/=108==216/
4|===81==162/
(so k=0)

A003586:
n: 1 2 3 4 5 6 7  8  9 10 11 12 13 14 15 16 17 18 19 20  21  22  23  24  25  26
a: 1 2 3 4 6 8 9 12 16 18 24 27 32 36 48 54 64 72 81 96 108 128 144 162 192 216


Converted to 3-smooth-index-values:

j\i___0____1____2____3____4____5____6____7_
0|*___1____2/___4____6/___9/__13___17/==22/
1|____3____5/___8___11/__15/==20===25/
2|____7___10/__14___18/==23/
3|___12___16/==21===26/
4|===19===24/

Example-i: Ord(2^i) = i*0 + Ord(2^i) + 1        -1 = Ord(2^i).
Example-j: Ord(3^j) = 0*j + 1        + Ord(3^j) -1 = Ord(3^j).
Example-A: Ord(6)   = 1*1 + 2        + 3        -1 = 5.
Example-B: Ord(54)  = 1*3 + 2        + 12       -1 = 16.
 

5-smooth

The three power-of-5 "planes", with terms up to 5^3,
with border lines per power-of-5:

k^0
j\i__0____1____2____3____4____5____6_
0|*  1 ___2____4/===8===16/  32 __64/
1|___3/===6===12===24/ _48___96/
2|===9===18/  36 __72_/
3|  27 __54__108/
4|__81/

k^1
j\i__0____1____2____3____4_
0|*  5 __10___20/==40===80/
1|__15/==30===60==120/
2|==45===90/

k^2
j\i__0____1____2_
0|* 25 __50__100/
1|__75/

Origin marked with *.

Because of the common multiplications,
the positional sub-shapes have the same form for each "plane",
so contain the same number of terms.

A051037:
n: 1, 2, 3, 4, 5, 6, 7, 8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,  34,  35,  36
a: 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 25, 27, 30, 32, 36, 40, 45, 48, 50, 54, 60, 64, 72, 75, 80, 81, 90, 96, 100, 108, 120


Converted to 5-smooth-index-values:

k=0
j\i__0____1____2____3____4____5____6_
0|   1 ___2____4/   7 __12/  19 __27/
1|___3/   6 __10___15/ _23___33/
2|___8___13/  20 __28_/
3|  17 __25___35/
4|__31/

k=1
j\i__0____1____2____3____4_
0|   5 ___9___14/  21 __30/
1|__11/  18 __26___36/
2|__22___32/

k=2
j\i__0____1____2_
0|  16 __24___34/
1|__29/


Formula:
    vc = [2, 3, 5], C = 3, vv = [i, j, k];
    Ord(vc[1]^vv[1] * vc[2]^vv[2] * vc[3]^vv[3])
      == Sum(c=1, C, g(c, vv, vc)) + 1.

C is the count of base values (#vc),
which is also the number of "5^k-planes".

The g() internally does the +Ord(vc[c]^vv[c]),
and the +i*j, and the -1 (to work 0-based),
and it could skip "unused planes".

(PARI)
my ( vc= [2,3,5], C= #vc, mr= /* term -> index */ );
g( c, vv )= {
  ...;
}
ok( vv )= {
  my
  ( v1= mapget( mr, vecprod([ vc[c]^vv[c] |c<-[1..C] ]) )
  , v2= Sum(c=1, C, g(c, vv, vc)) + 1
  );
  v1 == v2;
}
 

7-smooth

Homework!

-- -- -- --

In all of above, the first few primes are used as the base numbers,
but notice that it applies to
any n-tuple of (natural) numbers with each at least one distinct prime factor,
for example n coprimes.
 

On A003586 (3-smooth numbers)

A003586: Numbers of form 2^i * 3^j.
A022330: Index of 3^n within A003586.
A022331: Index of 2^n within A003586.

Mintz shows:
  a(n) = 2^i * 3^j for n = i * j + A022331(i) + A022330(j) - 1
(see link in A003586)

Another way to express that:
  Ord(2^i * 3^j) = i * j + Ord(2^i) + Ord(3^j) - 1

(PARI) A003586_Mintz_check(N=2^20, D=0)=
{ my(a=List(), t);
  for(j=0, logint(N, 3)
  , t=3^j;
    my(i=0);
    while(t<=N
    , listput(a, [t,i,j]);
      i++;
      t<<=1;
    )
  );
  a= Set(a);

  my(a022331=List(), a022330=List());
  for(n=1, #a
  , if(a[n][2] && !a[n][3]
    , listput(a022331,n)
    , if(!a[n][2] && a[n][3]
      , listput(a022330,n)
      )
    );
  );

  a022331= Vec(a022331);
  a022330= Vec(a022330);

  if( D
  , print(a022331);
    print(a022330);
    print([#a, #a022331, #a022330]);
  );

  my(ok=0);
  for(n=1, #a
  , my([i,j]= a[n][2..3]);
    if( n != i*j + if(i, a022331[i],1) + if(j, a022330[j],1) - 1
    , print("FAIL: ",a[n]); break;
    , ok++
    );
  );
  print([#a,ok]);
}

For character: https://patents.justia.com/inventor/donald-j-mintz

? A003586_Mintz_check(2^20, 1)
[2, 4, 6, 9, 13, 17, 22, 28, 34, 41, 48, 56, 65, 74, 84, 95, 106, 118, 130, 143]
[3, 7, 12, 19, 27, 37, 49, 62, 77, 93, 111, 131]
[143, 20, 12]
[143, 143]
cpu time = 2 ms, real time = 2 ms.

? A003586_Mintz_check(2^400)
[50801, 50801]
cpu time = 202 ms, real time = 205 ms.

? default(parisizemax,2^31)
  ***   Warning: new maximum stack size = 2147483648 (2048.000 Mbytes).

? A003586_Mintz_check(10^999)
[...]
  *** Set: Warning: increasing stack size to 2048000000.
[3476968, 3476968]
cpu time = 14,998 ms, real time = 15,485 ms.
 

On A010056 (Characteristic function of Fibonacci numbers)

A010056(n+1) = A005378(n) - A005379(n)

Has already been noticed, see A192687.
 

Have a "special page" for a(r,c) = a(r,c-1) + a(r-1,c)

______c_-2_-1__0___1___2___3___4___5___6___7_...
A011782: 0 +1  0 __1/  2   4   8  16  32  64 ... (also A034008)
A000079:+0 =1 _1/  2   4   8  16  32  64 128 ... (2^c, for c>=0)
A131577: 0__1/_2___4___8__16__32__64_128_256_...
A000225: 0  1  3   7  15  31  63 127 255 511 ...
A000295: 0  1  4  11  26  57 120 247 ...
A002662: 0  1  5  16  42  99 219 466 ...
A002663: 0  1  6  22  64 163 382 848 ...
A002664: 0  1  7  29  93 256 638 ...
[...]
(the row numbers are in column 0)
 

bitrev4

(PARI) bitrev4(v)= sum(i=0,3,bittest(v,3-i)<<i)

? [bitrev4(n)|n<-[0..15]]
[0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15]