GithubHelp home page GithubHelp logo

Hi there 👋

The following JS function provides the sum of the letters in some text (a = 1, b = 2, ... z = 26):

lettersum = t => t.toLowerCase().split("").filter(s => s.match(/[a-z]/)).map(l => l.codePointAt(0) - 96).reduce((a, b) => a + b);

This one computes be mod m:

modpow = (b, e, m) => {
    let r = 1;
    while (e > 0) {
        r = (r * b) % m;
        e--;
    }
    return r;
};

The following, using those functions, with my preferred name and surname in place of "text", outputs 1141:

const s = lettersum("text");
console.log(modpow(s, s, 8191));

vkcz's Projects

blairbash icon blairbash

Quote database for Montgomery Blair High School

mdprocess icon mdprocess

Heavily customisable browser-based Markdown renderer

quadtree_img icon quadtree_img

A quadtree-based image compression system and reference implementation

sstoy icon sstoy

Simple ShaderToy for X Windows & OpenGL ES 2.0

tsurch icon tsurch

A Rust CLI tool for searching the web

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.