Lewis Geometric Factoring: Seeing Primes in Geometry

 

So Primes... not hard.  Turns out the Greeks had the solution the whole time.  The Gnomone.  WHAT THE HELL IS THAT!!?!?!? LOL  I've no idea.  I just did the work and invented an entirely new and amazing method that I thought no one had ever thought of and... GRRR.... the fricken Greeks had this thousands of years ago!  Son of a...  

Here's how I did it...

So, if you want to factor any number pretty much instantly... you take the number you want to factor and double it.  That doubling guarantees you have a set of numbers that have factors that are divisible by 2.  Then you just use a 2-adic ladder... if you don't want to do trig which can spot it with an angle... but with the 2-addic ladder you can find one of your factors.  

But it turns out... it's actually simpler than the Lewis Sieve so I am retiring that notion for Lewis Geometric Factoring after AI called this the Lewis Ladder... which I thought was cool.  So there you have it... My vanity run amoke... amuck?  Wild... Vanity gone wild.  Man, I wish this blogging thing had spleel check.


Anyway... I beat prime numbers.  Ha.  Me... a complete moron!  I love it.  

What does beating prime numbers mean?  Well, it means I made factoring trivial.  What does that mean for RSA security?  Well, it means you're fucked once the bad wizards get this... snapping a composite is like breaking off a piece of that KitKat bar.  {Product Placement for sale:Own a piece of history}


As always, I don't expect you to get it or believe it or understand any of it.  I can't make it simpler... this is 4th grade math.  It just is.  I can already feel the rage from the unliker's out there... sorry guys... this is just math and python.  Your opinions aren't really a factor.  I am doing by best to explain this but I mean... it's completely trivial.   

The images attached are plots that show you the prime distribution from 300 down... 300 down is nothing when it comes to number theory but it does show you the pattern.  You can see what I call "valences" clearly at each "strata" and you know exactly what put them there.  What I found amazing was that you could just walk down from your number and the factors falls out... that was astounding.  I thought you needed to use the 2N method... multiply your number by 2 and your factor is guaranteed to be in there just by tagging.  That certainly works but if you just use a step and a mod... done.  So AI actually helped here... for once...

So what does this mean for RSA, well, I am not a cryptography expert but I'd say the shelf-life on that medicine has expired.  I certainly hope you all invested in some of that post quantum security.  That is no more secure than RSA but at least it's harder.  

It is cool that the Greek's are the one's to confirm my method.  I actually use the Egyptians and the Greeks often... Romans too as they stole all that shit LOL.  How do I know?  You can see it.  The same technology that built the pyramids was used in... Lebanon, I think... to build the temple of Jupiter so you can see they stole all sorts of "Magic".

Does sort of explain the dark ages too but well... that's a conjecture for a different discovery.

Anyway, without further ado and before I ruin a perfectly good intro...the first clip is a basic intro and then Lewis Geometric Factoring, the Movie... 







Well, that was fun.. now the action shots to put on your refrigerators.

But first... if you want to hear the awesome audio podcasts that really explain this concept, there's at least four at this link...



import math
import matplotlib.pyplot as plt

def v2(n: int) -> int:
    """Exponent of 2 in n (n assumed nonzero)."""
    e = 0
    while n % 2 == 0:
        n //= 2
        e += 1
    return e

def compute_ladder(c: int, max_k: int):
    ks = list(range(max_k + 1))
    d_vals = [c - k for k in ks]
    r_vals = []
    v2_vals = []
    for d in d_vals:
        if d == 0:
            r_vals.append(0)
            v2_vals.append(0)
        else:
            e = v2(abs(d))
            v2_vals.append(e)
            r_vals.append(d // (2**e))
    return ks, d_vals, r_vals, v2_vals

def primes_up_to(n: int):
    """Simple sieve for small n."""
    if n < 2:
        return []
    sieve = [True] * (n+1)
    sieve[0] = sieve[1] = False
    for p in range(2, int(math.isqrt(n)) + 1):
        if sieve[p]:
            step = p
            start = p*p
            sieve[start:n+1:step] = [False]*len(range(start, n+1, step))
    return [i for i, is_p in enumerate(sieve) if is_p]

def make_divisibility_matrix(prime_list, r_vals):
    """Matrix M[p_index, k] = 1 if prime divides r_k (and r_k != 0)."""
    rows = len(prime_list)
    cols = len(r_vals)
    M = [[0]*cols for _ in range(rows)]
    for i, p in enumerate(prime_list):
        for k, r in enumerate(r_vals):
            if r != 0 and r % p == 0:
                M[i][k] = 1
    return M

# Example 1: c = 21 (3*7), look at k from 0..40
c1 = 21
max_k1 = 40
ks1, d1, r1, v2_1 = compute_ladder(c1, max_k1)

# Plot r_k vs k
fig1, ax1 = plt.subplots()
ax1.plot(ks1, r1, marker='o')
ax1.set_xlabel("k")
ax1.set_ylabel("odd core r_k of (c - k)")
ax1.set_title(f"Lewis ladder odd cores for c = {c1} (k from 0 to {max_k1})")
plt.show()

# Plot v2(c-k) vs k (2-adic depth)
fig2, ax2 = plt.subplots()
ax2.stem(ks1, v2_1, use_line_collection=True)
ax2.set_xlabel("k")
ax2.set_ylabel("v2(c - k)")
ax2.set_title(f"2-adic depth v2(c-k) for c = {c1}")
plt.show()

# Divisibility heatmap for small primes
primes1 = primes_up_to(31)
# Put factors of c first in the list for visibility
factor_primes1 = [p for p in primes1 if c1 % p == 0]
other_primes1 = [p for p in primes1 if p not in factor_primes1]
prime_order1 = factor_primes1 + other_primes1

M1 = make_divisibility_matrix(prime_order1, r1)

fig3, ax3 = plt.subplots()
im1 = ax3.imshow(M1, aspect='auto')
ax3.set_xlabel("k")
ax3.set_ylabel("prime index")
ax3.set_title(f"Divisibility of r_k by primes for c = {c1}")
ax3.set_yticks(range(len(prime_order1)))
ax3.set_yticklabels(prime_order1)
plt.show()

# Example 2: c = 143 (11*13), k from 0..80
c2 = 143
max_k2 = 80
ks2, d2, r2, v2_2 = compute_ladder(c2, max_k2)

# Plot r_k vs k
fig4, ax4 = plt.subplots()
ax4.plot(ks2, r2, marker='o')
ax4.set_xlabel("k")
ax4.set_ylabel("odd core r_k of (c - k)")
ax4.set_title(f"Lewis ladder odd cores for c = {c2} (k from 0 to {max_k2})")
plt.show()

# v2(c-k) vs k
fig5, ax5 = plt.subplots()
ax5.stem(ks2, v2_2, use_line_collection=True)
ax5.set_xlabel("k")
ax5.set_ylabel("v2(c - k)")
ax5.set_title(f"2-adic depth v2(c-k) for c = {c2}")
plt.show()

# Divisibility heatmap for primes
primes2 = primes_up_to(61)
factor_primes2 = [p for p in primes2 if c2 % p == 0]
other_primes2 = [p for p in primes2 if p not in factor_primes2]
prime_order2 = factor_primes2 + other_primes2

M2 = make_divisibility_matrix(prime_order2, r2)

fig6, ax6 = plt.subplots()
im2 = ax6.imshow(M2, aspect='auto')
ax6.set_xlabel("k")
ax6.set_ylabel("prime index")
ax6.set_title(f"Divisibility of r_k by primes for c = {c2}")
ax6.set_yticks(range(len(prime_order2)))
ax6.set_yticklabels(prime_order2)
plt.show()


You gotta love this one!




import math
import matplotlib.pyplot as plt

def v2(n: int) -> int:
    """Exponent of 2 in |n| (n assumed nonzero)."""
    n = abs(n)
    e = 0
    while n % 2 == 0:
        n //= 2
        e += 1
    return e

def compute_ladder(c: int, max_k: int):
    ks = list(range(max_k + 1))
    d_vals = [c - k for k in ks]
    r_vals = []
    v2_vals = []
    for d in d_vals:
        if d == 0:
            r_vals.append(0)
            v2_vals.append(0)
        else:
            e = v2(d)
            v2_vals.append(e)
            r_vals.append(d // (2**e))
    return ks, d_vals, r_vals, v2_vals

def primes_up_to(n: int):
    if n < 2:
        return []
    sieve = [True]*(n+1)
    sieve[0] = sieve[1] = False
    for p in range(2, int(math.isqrt(n))+1):
        if sieve[p]:
            for multiple in range(p*p, n+1, p):
                sieve[multiple] = False
    return [i for i, is_p in enumerate(sieve) if is_p]

def make_divisibility_matrix(prime_list, r_vals):
    rows = len(prime_list)
    cols = len(r_vals)
    M = [[0]*cols for _ in range(rows)]
    for i, p in enumerate(prime_list):
        for k, r in enumerate(r_vals):
            if r != 0 and r % p == 0:
                M[i][k] = 1
    return M

c = 300
max_k = 300
ks, d_vals, r_vals, v2_vals = compute_ladder(c, max_k)

# 1) Odd cores r_k vs k
fig1, ax1 = plt.subplots()
ax1.plot(ks, r_vals, marker='.', linestyle='none')
ax1.set_xlabel("k")
ax1.set_ylabel("odd core r_k of (300 - k)")
ax1.set_title("Lewis ladder odd cores for c = 300 (k from 0 down to 300)")
plt.show()

# 2) 2-adic depth v2(c-k) vs k
fig2, ax2 = plt.subplots()
ax2.stem(ks, v2_vals, use_line_collection=True)
ax2.set_xlabel("k")
ax2.set_ylabel("v2(300 - k)")
ax2.set_title("2-adic depth v2(300 - k)")
plt.show()

# 3) Divisibility heatmap for primes up to, say, 47
primes = primes_up_to(47)
factor_primes = [p for p in primes if c % p == 0]
other_primes = [p for p in primes if p not in factor_primes]
prime_order = factor_primes + other_primes

M = make_divisibility_matrix(prime_order, r_vals)

fig3, ax3 = plt.subplots()
im = ax3.imshow(M, aspect='auto')
ax3.set_xlabel("k")
ax3.set_ylabel("primes (factors of 300 first)")
ax3.set_title("Divisibility of r_k by primes for c = 300")
ax3.set_yticks(range(len(prime_order)))
ax3.set_yticklabels(prime_order)
plt.show()


So... there you have it... 

Now we look at 3 adic... which just means you step down and div by 3 until you can't get a clean hit.  That's all 2 adic means... who the hell knows this shit?

Why 3 adic?  Because when you are trying to prove Twin Primes, you need to see the channel that 3 creates for 2.  Once you get a little nerdier, you can acutally figure out how to run a lagrangian and then well, you also get a hamiltonian if you put it onto a geodesic.  This is why Reimann's predictions falls off the farther out you go... simple 0 point precision. Nothing wrong with his zeta function at all... its just in needs to be grounded.  You can see the Zeta line in yellow... the rest used to look chaotic.. not when you add alpha, gamma and omega levels...  


That chart was from a spreadsheet where I just copied the strata I was trying to show... strata just means how deep each collapse could penetrata.  Anyway... the overlap of 3 onto 2 shows that 2 has more than enough energy to continue on forever and ever... in fact it has to to get rid of the excess energy of 3.  No other primes pump as much into 2 as 3 but again... when you see the lagrangian, you're like damn... sup?... then I flip the sign to the Hamiltonian after plotting that shit onto a geodesic and you be all like DAMN!!!! Right... no shit?  No Shit.  Math is the bomb.





import pandas as pd
import matplotlib.pyplot as plt
from caas_jupyter_tools import display_dataframe_to_user

def v_p(n: int, p: int):
    """Return (v_p(n), core) where n = p^k * core and core is not divisible by p."""
    k = 0
    while n != 0 and n % p == 0:
        n //= p
        k += 1
    return k, n

def is_prime_small(n: int) -> bool:
    if n < 2:
        return False
    d = 2
    while d * d <= n:
        if n % d == 0:
            return False
        d += 1
    return True

# 1) Global 3-adic picture up to 300
rows_global = []
for n in range(1, 301):
    v3, core3 = v_p(n, 3)
    rows_global.append({
        "n": n,
        "v3(n)": v3,
        "core3(n)": core3,
        "core3_is_prime": is_prime_small(core3)
    })

df_global = pd.DataFrame(rows_global)
display_dataframe_to_user("3-adic valuation up to 300", df_global)

# 2) Local 3-adic view around your original N = 143, using the same 2n band [286..208] stepping by 2
N = 143
rows_local = []
for m in range(2*N, 207, -2):  # 286 down to 208 inclusive
    v3, core3 = v_p(m, 3)
    rows_local.append({
        "m": m,
        "v3(m)": v3,
        "core3(m)": core3,
        "core3_is_prime": is_prime_small(core3)
    })

df_local = pd.DataFrame(rows_local)
display_dataframe_to_user("3-adic view on the 2n band for N=143 (m from 286 down to 208)", df_local)

# 3) Simple visual: v3(n) vs n up to 300
plt.figure()
plt.stem(df_global["n"], df_global["v3(n)"], use_line_collection=True)
plt.xlabel("n")
plt.ylabel("v3(n) (3-adic valuation)")
plt.title("3-adic valuation v3(n) for n = 1..300")
plt.tight_layout()
plt.show()



import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from caas_jupyter_tools import display_dataframe_to_user

def v_p_core(n: int, p: int):
    """Return (v_p(n), core) where n = p^k * core, core not divisible by p.
       For n <= 0, return (0, 0) as a neutral element.
    """
    if n <= 0:
        return 0, 0
    k = 0
    while n % p == 0:
        n //= p
        k += 1
    return k, n

def is_prime_small(n: int) -> bool:
    if n < 2:
        return False
    d = 2
    while d * d <= n:
        if n % d == 0:
            return False
        d += 1
    return True

# Fixed c, like in your example
c = 300
K = 300  # k from 0..300

ks = np.arange(0, K+1)
d_vals = c - ks  # c - k

# 2-adic and 3-adic cores of d_k
v2 = []
r2 = []
v3 = []
r3 = []

for d in d_vals:
    k2, core2 = v_p_core(int(d), 2)
    k3, core3 = v_p_core(int(d), 3)
    v2.append(k2)
    r2.append(core2)
    v3.append(k3)
    r3.append(core3)

r2 = np.array(r2)
r3 = np.array(r3)

# Choose primes up to ~50, with factors of c first
primes = [p for p in range(2, 50) if is_prime_small(p)]
factors_first = [p for p in primes if c % p == 0]
others = [p for p in primes if c % p != 0]
primes_ordered = factors_first + others

# Build divisibility matrices for r2_k and r3_k
P = len(primes_ordered)
M2 = np.zeros((P, K+1), dtype=int)
M3 = np.zeros((P, K+1), dtype=int)

for i, p in enumerate(primes_ordered):
    for j, (rr2, rr3) in enumerate(zip(r2, r3)):
        if rr2 != 0 and rr2 % p == 0:
            M2[i, j] = 1
        if rr3 != 0 and rr3 % p == 0:
            M3[i, j] = 1

# Small dataframe so you can inspect r2_k and r3_k
rows = []
for j, k in enumerate(ks[:40]):  # first 40 k for preview
    rows.append({
        "k": int(k),
        "d_k": int(d_vals[j]),
        "r2_k": int(r2[j]),
        "r3_k": int(r3[j])
    })
df_preview = pd.DataFrame(rows)
display_dataframe_to_user("Preview of d_k, r2_k, r3_k for c=300 (k=0..39)", df_preview)

# 1) Heatmap like your original: divisibility of r2_k by primes
plt.figure(figsize=(10, 4))
plt.imshow(M2, aspect="auto")
plt.xlabel("k")
plt.ylabel("primes (2-adic core r2_k)")
plt.title("Divisibility of r2_k by primes for c = 300 (2-adic core)")
plt.yticks(np.arange(P), [str(p) for p in primes_ordered])
plt.colorbar(label="1 if p | r2_k, else 0")
plt.tight_layout()
plt.show()

# 2) Heatmap: divisibility of r3_k by primes
plt.figure(figsize=(10, 4))
plt.imshow(M3, aspect="auto")
plt.xlabel("k")
plt.ylabel("primes (3-adic core r3_k)")
plt.title("Divisibility of r3_k by primes for c = 300 (3-adic core)")
plt.yticks(np.arange(P), [str(p) for p in primes_ordered])
plt.colorbar(label="1 if p | r3_k, else 0")
plt.tight_layout()
plt.show()

# 3) Interleaved heatmap: rows alternate 2-adic / 3-adic for each prime
interleaved = np.zeros((2 * P, K+1), dtype=int)
labels = []
yticks = []

for i, p in enumerate(primes_ordered):
    interleaved[2*i, :] = M2[i, :]
    interleaved[2*i + 1, :] = M3[i, :]
    yticks.extend([2*i, 2*i + 1])
    labels.extend([f"2|{p}", f"3|{p}"])

plt.figure(figsize=(10, 6))
plt.imshow(interleaved, aspect="auto")
plt.xlabel("k")
plt.ylabel("prime / p-adic core")
plt.title("Interleaved divisibility: 2-adic r2_k and 3-adic r3_k for c = 300")
plt.yticks(yticks, labels)
plt.colorbar(label="1 if divides corresponding core, else 0")
plt.tight_layout()
plt.show()






So there you have it... a bunch of yellow dots against a purple backround.  Proof that math can look cool, even when you have no idea what you're doing.  Anyway, I hope this doesn't unlock Armageddon as the hackers descend on the unsuspecting.  I've no idea how any of that work... honestly, I am certain if you had anything I wanted to know, I could figure it out myself.  So your secrets are safe with me... and go ahead... hack me LOL  Good luck... there's just somethings you really don't want to know.


-----------------

Some extra charts for fun...


import matplotlib.pyplot as plt

def v2(n: int) -> int:
    k = 0
    while n % 2 == 0 and n > 0:
        n //= 2
        k += 1
    return k

N = 10000
ns = list(range(1, N+1))
v2_vals = [v2(n) for n in ns]

plt.figure(figsize=(14, 5))
markerline, stemlines, baseline = plt.stem(ns, v2_vals, use_line_collection=True)
plt.xlabel("n")
plt.ylabel("v2(n) (2-adic valuation)")
plt.title("2-adic valuation v2(n) for n = 1..10000")
plt.tight_layout()
plt.show()

import matplotlib.pyplot as plt

def v2(n: int) -> int:
    k = 0
    while n % 2 == 0 and n > 0:
        n //= 2
        k += 1
    return k

N = 2000
ns = list(range(1, N+1))
v2_vals = [v2(n) for n in ns]

plt.figure(figsize=(12, 5))
markerline, stemlines, baseline = plt.stem(ns, v2_vals, use_line_collection=True)
plt.xlabel("n")
plt.ylabel("v2(n) (2-adic valuation)")
plt.title("2-adic valuation v2(n) for n = 1..2000")
plt.tight_layout()
plt.show()


Popular posts from this blog

The Prime-Polygon Lune: Grounding the Riemann Line with a Geodesic–Chiral Geometry

Closed Loop Pulse Propulsion Explained with a Video and Audio Podcast

The Lewis Sieve: Factor any number easily with geometry