Coder Social home page Coder Social logo

dissecting-primes's Introduction

So here's my original (dumb) sketch of a process for finding, mainly by random chance, "dissectable prime numbers".

  1. run div3.rb, and it will poop out a Ruby Array of digits which satisfy the property that they don't add up to a multiple of three, and no subset missing a single item does either. That's literally the only criterion here.
  2. copy that text and paste it into the code of primes.rb, in the obvious blob of array; edit to fix syntax, since I was lazy.
  3. run the new primes.rb and it will consider each set of digits you pasted in; in each step it will look for a dissectable prime among every possible permutation of the given digits, avoiding any that are shorter (starting with zeroes). If no winner is found, the counter is printed; if a winner is found, it's printed.

As a facepalm, I later wrote primes2.rb, which uses the Ruby Prime library and just looks through the functionally-defined sequence of prime numbers until it finds 50 dissectable ones. Be careful if you try to change that limit (50), because the numbers are much much scarcer as you go up in length of primes, and so it will sit there cranking along with no feedback for a Long Time if you try, say, the first 100 of them.

dissecting-primes's People

Contributors

vaguery avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.